Dashm commited on
Commit
2f7ee55
·
1 Parent(s): 917677e

Fix: use Docker build secret mount for HF_TOKEN

Browse files
Files changed (1) hide show
  1. Dockerfile +3 -4
Dockerfile CHANGED
@@ -18,10 +18,9 @@ RUN pip install --no-cache-dir -r requirements.txt
18
  COPY backend/ ./backend/
19
 
20
  # Download large model weights from HuggingFace Model Hub
21
- # HF_TOKEN is passed as a build secret from Space settings
22
- ARG HF_TOKEN
23
- ENV HF_TOKEN=${HF_TOKEN}
24
- RUN python backend/download_models.py
25
 
26
  # HuggingFace Spaces runs as non-root user — fix permissions
27
  RUN chmod -R 777 /app
 
18
  COPY backend/ ./backend/
19
 
20
  # Download large model weights from HuggingFace Model Hub
21
+ # HF_TOKEN is mounted as a build secret from Space settings
22
+ RUN --mount=type=secret,id=HF_TOKEN,mode=0444,required=false \
23
+ HF_TOKEN=$(cat /run/secrets/HF_TOKEN 2>/dev/null) python backend/download_models.py
 
24
 
25
  # HuggingFace Spaces runs as non-root user — fix permissions
26
  RUN chmod -R 777 /app