# CCVideo web UI — container image for Render (or any Docker host).
FROM python:3.12-slim

# System ffmpeg (yt-dlp/decoding); imageio-ffmpeg also bundles one as a fallback.
RUN apt-get update \
    && apt-get install -y --no-install-recommends ffmpeg \
    && rm -rf /var/lib/apt/lists/*

ENV PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    HF_HOME=/data/hf

WORKDIR /app

COPY requirements.txt .
RUN pip install --upgrade pip && pip install -r requirements.txt gunicorn

COPY . .

# Render injects $PORT. One worker (in-memory job state) + threads for the
# background transcription jobs. timeout 0 so long requests aren't killed.
CMD gunicorn -w 1 --threads 8 --timeout 0 -b 0.0.0.0:${PORT:-10000} webui:app
