Spaces:
Sleeping
Sleeping
File size: 903 Bytes
21f5d8a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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"]
|