Spaces:
Sleeping
Sleeping
Add better debug output for secrets in Dockerfile
Browse files- Dockerfile +8 -8
Dockerfile
CHANGED
|
@@ -33,27 +33,27 @@ RUN uv pip install huggingface_hub datasets
|
|
| 33 |
# Use a build arg for the token
|
| 34 |
ARG HF_TOKEN
|
| 35 |
# Check token availability using a simpler approach
|
| 36 |
-
RUN echo "
|
| 37 |
if [ -n "${HF_TOKEN}" ]; then \
|
| 38 |
-
echo "
|
| 39 |
python -c "from huggingface_hub import login; login(token='${HF_TOKEN}')"; \
|
| 40 |
else \
|
| 41 |
-
echo "
|
| 42 |
fi
|
| 43 |
|
| 44 |
# Use uv run to ensure we use the environment where datasets is installed
|
| 45 |
-
RUN uv run python download_pdfs.py
|
| 46 |
|
| 47 |
# Run preprocessing to generate the embeddings
|
| 48 |
# Note: This requires the OPENAI_API_KEY environment variable to be set during build
|
| 49 |
# For Hugging Face, you'll need to use their build secrets feature
|
| 50 |
ARG OPENAI_API_KEY
|
| 51 |
-
RUN echo "
|
| 52 |
if [ -n "${OPENAI_API_KEY}" ]; then \
|
| 53 |
-
echo "OPENAI_API_KEY is available
|
| 54 |
-
OPENAI_API_KEY=${OPENAI_API_KEY} uv run python preprocess.py; \
|
| 55 |
else \
|
| 56 |
-
echo "OPENAI_API_KEY
|
| 57 |
echo "WARNING: App will not work without preprocessed data!"; \
|
| 58 |
fi
|
| 59 |
|
|
|
|
| 33 |
# Use a build arg for the token
|
| 34 |
ARG HF_TOKEN
|
| 35 |
# Check token availability using a simpler approach
|
| 36 |
+
RUN echo "=================== CHECKING HF_TOKEN ===================" && \
|
| 37 |
if [ -n "${HF_TOKEN}" ]; then \
|
| 38 |
+
echo "HF_TOKEN is available (first character: ${HF_TOKEN:0:1}*)"; \
|
| 39 |
python -c "from huggingface_hub import login; login(token='${HF_TOKEN}')"; \
|
| 40 |
else \
|
| 41 |
+
echo "ERROR: HF_TOKEN is empty or not set!"; \
|
| 42 |
fi
|
| 43 |
|
| 44 |
# Use uv run to ensure we use the environment where datasets is installed
|
| 45 |
+
RUN uv run python download_pdfs.py || echo "WARNING: download_pdfs.py failed, but continuing build"
|
| 46 |
|
| 47 |
# Run preprocessing to generate the embeddings
|
| 48 |
# Note: This requires the OPENAI_API_KEY environment variable to be set during build
|
| 49 |
# For Hugging Face, you'll need to use their build secrets feature
|
| 50 |
ARG OPENAI_API_KEY
|
| 51 |
+
RUN echo "=================== CHECKING OPENAI_API_KEY ===================" && \
|
| 52 |
if [ -n "${OPENAI_API_KEY}" ]; then \
|
| 53 |
+
echo "OPENAI_API_KEY is available (first character: ${OPENAI_API_KEY:0:1}*)"; \
|
| 54 |
+
OPENAI_API_KEY=${OPENAI_API_KEY} uv run python preprocess.py || echo "WARNING: preprocessing failed, app will not work properly"; \
|
| 55 |
else \
|
| 56 |
+
echo "ERROR: OPENAI_API_KEY is empty or not set!"; \
|
| 57 |
echo "WARNING: App will not work without preprocessed data!"; \
|
| 58 |
fi
|
| 59 |
|