FROM nvidia/cuda:12.2.2-cudnn8-runtime-ubuntu22.04

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONUNBUFFERED=1

RUN apt-get update && apt-get install -y --no-install-recommends \
    python3 python3-pip ffmpeg git \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

# torch FEST auf cu124 (Treiber 550 = CUDA 12.4). 2.6.0 ist der NEUESTE cu124-
# Build — torch 2.7+ gibt es nur noch fuer cu126+, was 550 nicht unterstuetzt
# ("NVIDIA driver too old, found 12040"). Der Constraint haelt f5-tts davon ab,
# torch beim Dependency-Aufloesen wieder auf eine zu neue CUDA-Version zu ziehen.
RUN pip3 install --no-cache-dir torch==2.6.0 torchaudio==2.6.0 \
    --index-url https://download.pytorch.org/whl/cu124

COPY requirements.txt .
RUN printf 'torch==2.6.0\ntorchaudio==2.6.0\n' > /tmp/torch-constraint.txt && \
    pip3 install --no-cache-dir -c /tmp/torch-constraint.txt -r requirements.txt

COPY bridge.py .

CMD ["python3", "bridge.py"]
