# Utilisation d'une image légère avec support GPU
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04

# Configuration environnement
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app

# Installation des dépendances système (Audio + Python)
RUN apt-get update && apt-get install -y \
    python3.11 python3-pip ffmpeg libsndfile1 git \
    && rm -rf /var/lib/apt/lists/*

# 1. Installer d'abord PyTorch depuis la source NVIDIA/CUDA
RUN pip3 install --no-cache-dir \
    torch torchvision torchaudio \
    --index-url https://download.pytorch.org/whl/cu121

# 2. Installer le reste depuis le dépôt Python standard (PyPI)
RUN pip3 install --no-cache-dir \
    fastapi uvicorn gradio faster-whisper

# Copie du code serveur
COPY server.py .

# Exposition du port pour la communication interne
EXPOSE 7860

CMD ["python3.11", "server.py"]
