Cyrano2's picture
Update Dockerfile
155e956 verified
raw
history blame contribute delete
821 Bytes
FROM python:3.10-slim
# Variables d'environnement pour Hugging Face Spaces
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
WORKDIR /app
# Installer les dépendances système nécessaires
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
libhdf5-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Copier et installer les dépendances Python
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r requirements.txt
# Copier l'application
COPY app.py .
# Port pour Hugging Face Spaces (obligatoire: 7860)
EXPOSE 7860
# Créer un utilisateur non-root (requis par HF Spaces)
RUN useradd -m -u 1000 user
USER user
# Démarrer l'application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]