File size: 992 Bytes
e1329f4
e4d3035
e88861e
e1329f4
e88861e
 
 
 
e4d3035
56b3376
e1329f4
 
 
 
 
59c38e1
e1329f4
59c38e1
 
e1329f4
56b3376
 
e1329f4
d3ec3d3
e1329f4
56b3376
e1329f4
59c38e1
d2fd474
e1329f4
d42f1d2
 
e1329f4
d42f1d2
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 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"]