Spaces:
Running
Running
| FROM python:3.11-slim | |
| # Outils minimes (curl pour healthcheck) | |
| RUN apt-get update && apt-get install -y --no-install-recommends curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Deps | |
| COPY requirements.txt . | |
| RUN python -m pip install --upgrade pip && pip install -r requirements.txt | |
| # Code | |
| COPY main.py . | |
| # HF Spaces fournit PORT (ex: 7860). On met une valeur par défaut au cas où. | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Healthcheck sur /health | |
| HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=3 \ | |
| CMD curl -fsS "http://localhost:${PORT}/health" || exit 1 | |
| # 🔑 IMPORTANT : on lance via Python, qui lit $PORT et démarre Uvicorn dessus | |
| CMD ["python", "-u", "/app/main.py"] | |