This commit is contained in:
2026-02-24 17:52:46 +01:00
parent 1c151c0e52
commit 2ebb89f113

View File

@ -1,28 +1,40 @@
# Utilisation d'une image légère avec support GPU # Utilisation d'une image stable avec support GPU
FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04
# Configuration environnement # Configuration environnement
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /app WORKDIR /app
# Installation des dépendances système (Audio + Python) # Installation des dépendances système (Audio + Python 3.11)
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
python3.11 python3-pip ffmpeg libsndfile1 git \ python3.11 \
python3-pip \
ffmpeg \
libsndfile1 \
git \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# 1. Installer d'abord PyTorch depuis la source NVIDIA/CUDA # Mise à jour de pip pour éviter les avertissements
RUN pip3 install --no-cache-dir \ RUN python3.11 -m pip install --upgrade pip
# 1. Installer PyTorch avec le lien direct CUDA 12.1
# On utilise "python3.11 -m pip" pour garantir que Gradio sera trouvé par Python 3.11
RUN python3.11 -m pip install --no-cache-dir \
torch torchvision torchaudio \ torch torchvision torchaudio \
--index-url https://download.pytorch.org/whl/cu121 --index-url https://download.pytorch.org/whl/cu121
# 2. Installer le reste depuis le dépôt Python standard (PyPI) # 2. Installer le reste des dépendances
RUN pip3 install --no-cache-dir \ RUN python3.11 -m pip install --no-cache-dir \
fastapi uvicorn gradio faster-whisper fastapi \
uvicorn \
gradio \
faster-whisper
# Copie du code serveur # Copie du code serveur (sera écrasé par le volume en dev, mais utile pour le build)
COPY server.py . COPY server.py .
# Exposition du port pour la communication interne # Exposition du port Gradio
EXPOSE 7860 EXPOSE 7860
# Lancement explicite avec Python 3.11
CMD ["python3.11", "server.py"] CMD ["python3.11", "server.py"]