FROM nvidia/cuda:12.9.0-runtime-ubuntu24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        python3 python3-pip python3-venv libpython3.12-dev \
        ffmpeg libsndfile1 curl \
        libavutil-dev libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev && \
    ln -sf /usr/bin/python3 /usr/bin/python && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /app

# Точные версии из рабочего окружения: torch 2.11.0+cu130, sm_120 поддерживается
RUN pip install --no-cache-dir --break-system-packages \
    torch==2.11.0 torchaudio==2.11.0 \
    --index-url https://download.pytorch.org/whl/cu130

COPY requirements.txt .
RUN pip install --no-cache-dir --break-system-packages -r requirements.txt

COPY app.py .

EXPOSE 8002

CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8002"]
