Spaces:
Runtime error
Runtime error
| # 📦 Image de base Python 3.10 | |
| FROM python:3.10 | |
| # ✅ Installer les outils système nécessaires à llama-cpp et transformers | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| cmake \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # ✅ Configuration du cache HF dans un dossier autorisé | |
| ENV HF_HOME=/app/cache \ | |
| TRANSFORMERS_CACHE=/app/cache \ | |
| HF_MODULES_CACHE=/app/cache \ | |
| HF_HUB_CACHE=/app/cache | |
| # ✅ Création du dossier cache avec accès complet | |
| RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
| # 📁 Dossier de travail dans le conteneur | |
| WORKDIR /app | |
| # 🧪 Installer les dépendances Python en premier | |
| COPY requirements.txt . | |
| RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt | |
| # 🧠 Copier le code de l’application (ex: app.py) | |
| COPY . . | |
| # 🌐 Exposer le port HTTP pour l’API FastAPI | |
| EXPOSE 7860 | |
| # 🚀 Commande de démarrage du serveur Uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |