Spaces:
Sleeping
Sleeping
| # Image légère Python | |
| FROM python:3.11-slim | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PIP_NO_CACHE_DIR=1 \ | |
| HF_HOME=/root/.cache/huggingface | |
| # Déps système minimales (certs, locales, build basique) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential curl ca-certificates git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Fichiers app | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --upgrade pip \ | |
| && pip install -r /app/requirements.txt | |
| # Copier le code | |
| COPY app /app/app | |
| # (Optionnel) Pré-télécharger le modèle au build pour accélérer le premier run | |
| RUN ls -la | |
| COPY model_downloader.py /app/model_downloader.py | |
| RUN python /app/model_downloader.py | |
| # HF Spaces: écouter sur $PORT (par défaut 7860) | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Lancer l'app | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |