FROM python:3.12-slim

ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1

WORKDIR /app

RUN apt-get update \
    && apt-get install -y --no-install-recommends ffmpeg curl ca-certificates \
    && rm -rf /var/lib/apt/lists/*

COPY requirements.txt /app/requirements.txt

# Install a CUDA-enabled PyTorch wheel explicitly; the NVIDIA container runtime
# supplies access to the host driver/GPU.
RUN python -m pip install --upgrade pip \
    && python -m pip install "torch>=2.4" --index-url https://download.pytorch.org/whl/cu124 \
    && python -m pip install -r /app/requirements.txt

COPY scene_search /app/scene_search

CMD ["python", "-m", "scene_search.cli", "serve"]
