kamkol commited on
Commit
e41df66
·
1 Parent(s): 4b39041

Add better debug output for secrets in Dockerfile

Browse files
Files changed (1) hide show
  1. 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 "Checking if HF_TOKEN is available..." && \
37
  if [ -n "${HF_TOKEN}" ]; then \
38
- echo "Token is available, attempting login"; \
39
  python -c "from huggingface_hub import login; login(token='${HF_TOKEN}')"; \
40
  else \
41
- echo "No token available, skipping login"; \
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 "Checking if OPENAI_API_KEY is available..." && \
52
  if [ -n "${OPENAI_API_KEY}" ]; then \
53
- echo "OPENAI_API_KEY is available, running preprocessing"; \
54
- OPENAI_API_KEY=${OPENAI_API_KEY} uv run python preprocess.py; \
55
  else \
56
- echo "OPENAI_API_KEY not available, skipping preprocessing"; \
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