diff --git a/Dockerfile b/Dockerfile index 758642f..9b043fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,21 +8,34 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ WORKDIR /app +# System deps: ffmpeg for video processing RUN apt-get update \ && apt-get install -y --no-install-recommends \ ffmpeg \ curl \ && rm -rf /var/lib/apt/lists/* +# Install PyTorch CPU-only first (saves ~1.5GB vs GPU version) +RUN pip install --no-cache-dir torch==2.11.0 --index-url https://download.pytorch.org/whl/cpu + +# Install remaining Python deps COPY requirements.txt ./ -RUN pip install --upgrade pip \ - && pip install -r requirements.txt \ - && pip install pytest +RUN pip install --no-cache-dir --upgrade pip \ + && pip install --no-cache-dir -r requirements.txt +# Install Chromium for Playwright (already cached at /ms-playwright) RUN python -m playwright install --with-deps chromium +# Clean up pip cache and temp files +RUN pip cache purge 2>/dev/null || true \ + && find /usr/local/lib/python3.14 -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true \ + && find /usr/local/lib/python3.14 -name '*.pyc' -delete 2>/dev/null || true \ + && rm -rf /root/.cache + +# Copy app code COPY . . +# Create non-root user RUN groupadd -r appuser && useradd -r -g appuser -d /app appuser \ && chown -R appuser:appuser /app /ms-playwright