gabrielchua commited on
Commit
58832cd
·
verified ·
1 Parent(s): e2911e0

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -3
Dockerfile CHANGED
@@ -26,11 +26,19 @@ RUN pip install --no-cache-dir --upgrade pip && \
26
  pip install --no-cache-dir -r requirements.txt
27
 
28
  # Pre-download the SentenceTransformer embedding model to avoid runtime cold-starts
29
- RUN HF_TOKEN=$HF_TOKEN HUGGINGFACEHUB_API_TOKEN=$HF_TOKEN HUGGINGFACE_HUB_TOKEN=$HF_TOKEN \
30
- python - <<'PY'
 
 
 
 
31
  from sentence_transformers import SentenceTransformer
32
 
33
- SentenceTransformer("google/embeddinggemma-300m")
 
 
 
 
34
  PY
35
 
36
  # Copy the rest of the application code
 
26
  pip install --no-cache-dir -r requirements.txt
27
 
28
  # Pre-download the SentenceTransformer embedding model to avoid runtime cold-starts
29
+ RUN if [ -z "$HF_TOKEN" ]; then \
30
+ echo "HF_TOKEN build arg is required to download google/embeddinggemma-300m" >&2; \
31
+ exit 1; \
32
+ fi && \
33
+ HF_TOKEN=$HF_TOKEN python - <<'PY'
34
+ import os
35
  from sentence_transformers import SentenceTransformer
36
 
37
+ token = os.environ.get("HF_TOKEN")
38
+ if not token:
39
+ raise SystemExit("HF_TOKEN environment variable missing during build")
40
+
41
+ SentenceTransformer("google/embeddinggemma-300m", use_auth_token=token)
42
  PY
43
 
44
  # Copy the rest of the application code