-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
44 lines (34 loc) · 956 Bytes
/
Copy pathDockerfile
File metadata and controls
44 lines (34 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Multi-stage build for raspberry-llm
# Stage 1: Base with system dependencies
FROM python:3.11-slim AS base
# Install system dependencies for OpenCV, audio, and camera
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libgl1 \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
portaudio19-dev \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Stage 2: Dependencies
FROM base AS deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Stage 3: Runtime
FROM deps AS runtime
# Copy application code
COPY . .
# Create non-root user for security
RUN useradd --create-home appuser && chown -R appuser:appuser /app
USER appuser
# Environment
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Health check
HEALTHCHECK --interval=30s --timeout=3s \
CMD python -c "import src; print('OK')" || exit 1
# Entry point
CMD ["python", "main.py"]