FROM python:3.11-slim # Utilisateur non root : requis par Hugging Face Spaces RUN useradd -m -u 1000 user RUN apt-get update && apt-get install -y --no-install-recommends \ curl \ && rm -rf /var/lib/apt/lists/* USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 \ GRADIO_SERVER_NAME=0.0.0.0 \ PORT=7860 WORKDIR $HOME/app COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip \ && pip install --no-cache-dir -r requirements.txt COPY --chown=user app.py . EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \ CMD curl -fsS http://localhost:7860/ || exit 1 CMD ["python", "app.py"]