Marcin-XStudio commited on
Commit
9ff9c2f
·
1 Parent(s): a943bdd
Files changed (1) hide show
  1. Dockerfile +7 -5
Dockerfile CHANGED
@@ -4,7 +4,7 @@ FROM python:3.10-slim
4
  ENV HF_HOME="/home/user/.cache/huggingface" \
5
  HF_HUB_CACHE="/home/user/.cache/huggingface/hub" \
6
  TRANSFORMERS_CACHE="/home/user/.cache/huggingface/transformers" \
7
- DOCLING_ARTIFACTS_PATH="/home/user/.cache/docling/models" \
8
  OMP_NUM_THREADS=2
9
 
10
 
@@ -23,16 +23,18 @@ RUN pip install --no-cache-dir torch torchvision --extra-index-url https://downl
23
  RUN pip install --no-cache-dir huggingface_hub
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
 
 
 
26
  # 4-bis) Install Docling and prefetch its models
27
  RUN pip install --no-cache-dir docling \
28
  && docling-tools models download
29
 
30
  # 5) Pré-créer model_cache et HF_HOME, puis chown
31
- RUN mkdir -p /home/user/app/model_cache $HF_HUB_CACHE \
32
- && chown -R user:user /home/user/app /home/user/.cache/huggingface
33
 
34
- # 6) Télécharger le modèle au build-time sous l’utilisateur non-root
35
- USER user
36
  RUN python - <<EOF
37
  import os
38
  from huggingface_hub import snapshot_download
 
4
  ENV HF_HOME="/home/user/.cache/huggingface" \
5
  HF_HUB_CACHE="/home/user/.cache/huggingface/hub" \
6
  TRANSFORMERS_CACHE="/home/user/.cache/huggingface/transformers" \
7
+ DOCLING_ARTIFACTS_PATH="/home/user/.cache/docling/models" \
8
  OMP_NUM_THREADS=2
9
 
10
 
 
23
  RUN pip install --no-cache-dir huggingface_hub
24
  RUN pip install --no-cache-dir -r requirements.txt
25
 
26
+ # sous l’utilisateur non-root
27
+ USER user
28
+
29
  # 4-bis) Install Docling and prefetch its models
30
  RUN pip install --no-cache-dir docling \
31
  && docling-tools models download
32
 
33
  # 5) Pré-créer model_cache et HF_HOME, puis chown
34
+ RUN mkdir -p /home/user/app/model_cache $HF_HUB_CACHE /home/user/.cache/docling/models \
35
+ && chown -R user:user /home/user/app /home/user/.cache/huggingface /home/user/.cache/docling
36
 
37
+ # 6) Télécharger le modèle au build-time
 
38
  RUN python - <<EOF
39
  import os
40
  from huggingface_hub import snapshot_download