2nzi commited on
Commit
41a3ee7
·
1 Parent(s): 40a236c
Files changed (1) hide show
  1. Dockerfile +21 -10
Dockerfile CHANGED
@@ -1,10 +1,21 @@
1
- FROM python:3.10-slim
2
-
3
- WORKDIR /app
4
-
5
- COPY requirements.txt .
6
- RUN pip install --no-cache-dir -r requirements.txt
7
-
8
- COPY . .
9
-
10
- CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ # 1. Ajoute un utilisateur non-root pour HF
4
+ RUN useradd -m -u 1000 user
5
+ USER user
6
+
7
+ # 2. Répertoire de travail
8
+ WORKDIR /app
9
+
10
+ # 3. Assure-toi que les binaires pip installés sont accessibles
11
+ ENV PATH="/home/user/.local/bin:$PATH"
12
+
13
+ # 4. Installation des dépendances
14
+ COPY --chown=user requirements.txt .
15
+ RUN pip install --no-cache-dir -r requirements.txt
16
+
17
+ # 5. Copie du code de l'API
18
+ COPY --chown=user . .
19
+
20
+ # 6. Lancement de l'application
21
+ CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]