Spaces:
Running
Running
Update Dockerfile
Browse files- 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
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
from sentence_transformers import SentenceTransformer
|
| 32 |
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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
|