DataSage12 commited on
Commit
4ecd4b9
·
verified ·
1 Parent(s): e5e4877

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +36 -27
Dockerfile CHANGED
@@ -1,27 +1,36 @@
1
- FROM python:3.11-slim
2
-
3
- ENV PYTHONDONTWRITEBYTECODE=1 \
4
- PYTHONUNBUFFERED=1 \
5
- PIP_DEFAULT_TIMEOUT=600
6
-
7
- WORKDIR /app
8
-
9
- RUN apt-get update && apt-get install -y --no-install-recommends git \
10
- && rm -rf /var/lib/apt/lists/*
11
-
12
- # Upgrade pip/wheel
13
- RUN pip install --no-cache-dir --upgrade pip setuptools wheel
14
-
15
- # 🔧 Torch CPU dispo sur l'index officiel (version confirmée dans ton log)
16
- RUN pip --retries 5 --default-timeout=600 install --no-cache-dir \
17
- torch==2.3.1+cpu \
18
- -f https://download.pytorch.org/whl/torch_stable.html
19
-
20
- # Le reste des deps
21
- COPY requirements.txt .
22
- RUN pip --retries 5 --default-timeout=600 install --no-cache-dir -r requirements.txt
23
-
24
- COPY . .
25
-
26
- EXPOSE 7860
27
- CMD ["uvicorn", "app.main:app", "--host","0.0.0.0","--port","7860"]
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ ENV PYTHONDONTWRITEBYTECODE=1 \
4
+ PYTHONUNBUFFERED=1 \
5
+ PIP_DEFAULT_TIMEOUT=600 \
6
+ HF_HOME=/app/.cache \
7
+ TRANSFORMERS_CACHE=/app/.cache \
8
+ HUGGINGFACE_HUB_CACHE=/app/.cache
9
+
10
+ WORKDIR /app
11
+
12
+ # Outils utiles
13
+ RUN apt-get update && apt-get install -y --no-install-recommends git \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Pip à jour
17
+ RUN pip install --no-cache-dir --upgrade pip setuptools wheel
18
+
19
+ # ⚠️ Torch CPU depuis l'index officiel PyTorch (fiable)
20
+ RUN pip --retries 5 --default-timeout=600 install --no-cache-dir \
21
+ torch==2.3.1+cpu \
22
+ -f https://download.pytorch.org/whl/torch_stable.html
23
+
24
+ # Dépendances restantes (sans torch dans requirements.txt)
25
+ COPY requirements.txt .
26
+ RUN pip --retries 5 --default-timeout=600 install --no-cache-dir -r requirements.txt
27
+
28
+ # ✅ Crée le dossier cache et donne les droits
29
+ RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
30
+
31
+ # Code
32
+ COPY . .
33
+
34
+ # Port attendu par Hugging Face Spaces (Docker)
35
+ EXPOSE 7860
36
+ CMD ["uvicorn", "app.main:app", "--host","0.0.0.0","--port","7860"]