# Étape 1 : Base légère FROM python:3.10-slim # Étape 2 : Environnement ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV HF_TOKEN=${HF_TOKEN} # Étape 3 : Outils système RUN apt-get update && apt-get install -y git curl && apt-get clean # Étape 4 : Répertoire de travail WORKDIR /app COPY . /app # Étape 5 : Dépendances Python RUN pip install --no-cache-dir --upgrade pip RUN pip install --no-cache-dir \ huggingface_hub \ transformers \ datasets \ accelerate \ torch \ flask \ sentencepiece \ tokenizers \ tqdm # Étape 6 : Authentification Hugging Face (nouvelle syntaxe) # Vérifie si la variable HF_TOKEN est définie avant de se loguer RUN if [ -n "${HF_TOKEN}" ]; then \ huggingface-cli login --token ${HF_TOKEN}; \ else \ echo "⚠️ Aucun token Hugging Face fourni (HF_TOKEN manquant)"; \ fi # Étape 7 : Port de l’API EXPOSE 7860 # Étape 8 : Lancement du serveur Flask CMD ["python", "server/api.py"]