This repository has been archived on 2026-05-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
bvandeusen 38942c211d fix(ml): install ffmpeg in ml-worker image for video frame sampling
extract_video_frames() calls ffprobe/ffmpeg, which were only installed
in the web Dockerfile. Videos route through the ml-worker for WD14 +
SigLIP inference, so the tool needs to exist there too.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 17:48:54 -04:00

43 lines
1.7 KiB
OCaml

# syntax=docker/dockerfile:1
FROM python:3.12-slim AS base
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PIP_NO_CACHE_DIR=1 \
ML_MODEL_DIR=/models
# System deps: Pillow / image handling + psycopg2 runtime libpq + ffmpeg for
# video frame sampling (WD14+SigLIP inference on videos calls ffprobe/ffmpeg).
RUN apt-get update && apt-get install -y --no-install-recommends \
libgl1 \
libglib2.0-0 \
libpq5 \
ffmpeg \
&& rm -rf /var/lib/apt/lists/*
WORKDIR /app
# Install PyTorch CPU wheel first from its dedicated index to avoid pulling CUDA libs.
# Floor only buildkit will pick the latest matching CPU wheel; keep this above the app-deps
# layer so transformers on PyPI doesn't accidentally resolve a mismatched torch.
RUN pip install --no-cache-dir \
--index-url https://download.pytorch.org/whl/cpu \
"torch>=2.5"
# Install ML requirements. Models are NOT baked in the entrypoint fetches them
# at container start into the ${ML_MODEL_DIR} volume, and huggingface_hub's
# content-based integrity check makes subsequent starts a no-op.
COPY requirements-ml.txt /app/requirements-ml.txt
RUN pip install --no-cache-dir -r requirements-ml.txt
# Copy application code (needed so Celery can import app.tasks.ml and app.ml).
# config.py lives at the repo root and is imported by app/__init__.py via 'config.Config'.
COPY app /app/app
COPY config.py /app/config.py
COPY scripts/ensure_models.py /app/scripts/ensure_models.py
COPY scripts/entrypoint-ml.sh /app/scripts/entrypoint-ml.sh
RUN chmod +x /app/scripts/entrypoint-ml.sh && mkdir -p ${ML_MODEL_DIR}
ENTRYPOINT ["/app/scripts/entrypoint-ml.sh"]
CMD ["celery", "-A", "app.celery_app:celery", "worker", "--loglevel=info", "-Q", "ml", "--concurrency=1"]