FROM python:3.11-slim WORKDIR /app # libgl1/libglib nécessaires au runtime d'opencv-python-headless sur Debian slim RUN apt-get update && apt-get install -y --no-install-recommends \ libgl1 libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* COPY requirements.txt . # CPU-only : évite de télécharger les wheels PyTorch CUDA (inutiles sur Hugging Face Spaces gratuit) RUN pip install --no-cache-dir --extra-index-url https://download.pytorch.org/whl/cpu -r requirements.txt COPY app/ app/ COPY monitoring/ monitoring/ COPY models/ models/ # 7860 = port par défaut attendu par Hugging Face Spaces (Docker SDK) EXPOSE 7860 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]