Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +14 -14
Dockerfile
CHANGED
|
@@ -1,34 +1,34 @@
|
|
| 1 |
-
# 📦 Image de base
|
| 2 |
FROM python:3.10
|
| 3 |
|
| 4 |
-
# ✅ Installer les outils nécessaires
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
cmake \
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
-
# ✅
|
| 12 |
-
ENV HF_HOME=/app/cache
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
|
| 17 |
-
# ✅
|
| 18 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 19 |
|
| 20 |
-
# 📁 Dossier de travail
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
-
# 🧪 Installer les dépendances
|
| 24 |
COPY requirements.txt .
|
| 25 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
-
# 🧠 Copier
|
| 28 |
COPY . .
|
| 29 |
|
| 30 |
-
# 🌐 Exposer le port HTTP
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
-
# 🚀
|
| 34 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 1 |
+
# 📦 Image de base Python 3.10
|
| 2 |
FROM python:3.10
|
| 3 |
|
| 4 |
+
# ✅ Installer les outils système nécessaires à llama-cpp et transformers
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
build-essential \
|
| 7 |
cmake \
|
| 8 |
git \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# ✅ Configuration du cache HF dans un dossier autorisé
|
| 12 |
+
ENV HF_HOME=/app/cache \
|
| 13 |
+
TRANSFORMERS_CACHE=/app/cache \
|
| 14 |
+
HF_MODULES_CACHE=/app/cache \
|
| 15 |
+
HF_HUB_CACHE=/app/cache
|
| 16 |
|
| 17 |
+
# ✅ Création du dossier cache avec accès complet
|
| 18 |
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
|
| 19 |
|
| 20 |
+
# 📁 Dossier de travail dans le conteneur
|
| 21 |
WORKDIR /app
|
| 22 |
|
| 23 |
+
# 🧪 Installer les dépendances Python en premier
|
| 24 |
COPY requirements.txt .
|
| 25 |
+
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
|
| 26 |
|
| 27 |
+
# 🧠 Copier le code de l’application (ex: app.py)
|
| 28 |
COPY . .
|
| 29 |
|
| 30 |
+
# 🌐 Exposer le port HTTP pour l’API FastAPI
|
| 31 |
EXPOSE 7860
|
| 32 |
|
| 33 |
+
# 🚀 Commande de démarrage du serveur Uvicorn
|
| 34 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|