Spaces:
Sleeping
Sleeping
Improve Dockerfile HF_TOKEN handling with better error messages
Browse files- Dockerfile +14 -4
Dockerfile
CHANGED
|
@@ -26,12 +26,22 @@ RUN uv sync
|
|
| 26 |
# Create data directory if it doesn't exist
|
| 27 |
RUN mkdir -p $HOME/app/data
|
| 28 |
|
| 29 |
-
# Install huggingface_hub and datasets
|
| 30 |
-
|
| 31 |
-
RUN uv pip install huggingface_hub datasets && \
|
| 32 |
-
uv run python -c "from huggingface_hub import login; login(token='${HF_TOKEN}')"
|
| 33 |
|
| 34 |
# Download PDFs from Hugging Face dataset
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
RUN python download_pdfs.py
|
| 36 |
|
| 37 |
# Run preprocessing to generate the embeddings
|
|
|
|
| 26 |
# Create data directory if it doesn't exist
|
| 27 |
RUN mkdir -p $HOME/app/data
|
| 28 |
|
| 29 |
+
# Install huggingface_hub and datasets
|
| 30 |
+
RUN uv pip install huggingface_hub datasets
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# Download PDFs from Hugging Face dataset
|
| 33 |
+
# Use a build arg for the token
|
| 34 |
+
ARG HF_TOKEN
|
| 35 |
+
# Echo first character of token (for debugging, redacted for security)
|
| 36 |
+
RUN echo "HF_TOKEN starts with: ${HF_TOKEN:0:1}..."
|
| 37 |
+
# Try to use the token more explicitly
|
| 38 |
+
RUN if [ -n "${HF_TOKEN}" ]; then \
|
| 39 |
+
echo "Token is available, attempting login"; \
|
| 40 |
+
python -c "from huggingface_hub import login; login(token='${HF_TOKEN}')"; \
|
| 41 |
+
else \
|
| 42 |
+
echo "No token available, skipping login"; \
|
| 43 |
+
fi
|
| 44 |
+
|
| 45 |
RUN python download_pdfs.py
|
| 46 |
|
| 47 |
# Run preprocessing to generate the embeddings
|