Bambo TRAORE [SNT DRPS/PEX/SDN] commited on
Commit
a2fb703
·
1 Parent(s): 096b6ed
Files changed (1) hide show
  1. Dockerfile +15 -2
Dockerfile CHANGED
@@ -1,16 +1,29 @@
1
- # Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
- # you will also find guides on how best to write your Dockerfile
3
 
4
  FROM python:3.9
5
 
 
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
 
10
  WORKDIR /app
11
 
 
12
  COPY --chown=user ./requirements.txt requirements.txt
13
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
14
 
 
 
 
 
 
 
 
 
 
15
  COPY --chown=user . /app
 
 
16
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Hugging Face Spaces compatible Dockerfile
 
2
 
3
  FROM python:3.9
4
 
5
+ # Crée un user non root
6
  RUN useradd -m -u 1000 user
7
  USER user
8
  ENV PATH="/home/user/.local/bin:$PATH"
9
 
10
+ # Dossier de travail
11
  WORKDIR /app
12
 
13
+ # Copie les requirements et installe les dépendances Python
14
  COPY --chown=user ./requirements.txt requirements.txt
15
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
16
 
17
+ # ✅ Étape essentielle : installer les dépendances système (libGL, poppler, etc.)
18
+ USER root
19
+ RUN apt-get update && apt-get install -y \
20
+ libgl1 \
21
+ poppler-utils \
22
+ && rm -rf /var/lib/apt/lists/*
23
+ USER user
24
+
25
+ # Copie du code
26
  COPY --chown=user . /app
27
+
28
+ # Commande de démarrage
29
  CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]