Developer commited on
Commit
e50a10b
·
1 Parent(s): 328fbb6

Fix: Remove duplicate torch, remove healthcheck, add logging

Browse files
Files changed (2) hide show
  1. Dockerfile +9 -12
  2. requirements.txt +1 -1
Dockerfile CHANGED
@@ -19,16 +19,18 @@ ENV HOME=/home/user \
19
  # Set working directory for user
20
  WORKDIR $HOME/app
21
 
22
- # Install torch CPU first (smaller download)
23
  RUN pip install --no-cache-dir --upgrade pip && \
24
- pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu
 
25
 
26
  # Copy requirements and install Python dependencies
27
  COPY --chown=user requirements.txt .
28
- RUN pip install --no-cache-dir -r requirements.txt
 
29
 
30
  # Pre-download the lightweight embedding model to avoid timeout at startup
31
- RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2')"
32
 
33
  # Copy application files
34
  COPY --chown=user . .
@@ -39,15 +41,10 @@ RUN mkdir -p /tmp/chroma_db /tmp/data_cache
39
  # Set environment variables
40
  ENV PYTHONUNBUFFERED=1
41
  ENV SPACE_ID=1
42
- ENV GRADIO_SERVER_NAME=0.0.0.0
43
- ENV GRADIO_SERVER_PORT=7860
44
 
45
  # Expose port for Streamlit (HuggingFace Spaces uses 7860)
46
  EXPOSE 7860
47
 
48
- # Health check - increase timeout
49
- HEALTHCHECK --interval=30s --timeout=30s --start-period=60s --retries=3 \
50
- CMD curl --fail http://localhost:7860/_stcore/health || exit 1
51
-
52
- # Run Streamlit
53
- CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]
 
19
  # Set working directory for user
20
  WORKDIR $HOME/app
21
 
22
+ # Install torch CPU first (smaller download ~200MB vs 2GB)
23
  RUN pip install --no-cache-dir --upgrade pip && \
24
+ pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu && \
25
+ echo "Torch installed successfully"
26
 
27
  # Copy requirements and install Python dependencies
28
  COPY --chown=user requirements.txt .
29
+ RUN pip install --no-cache-dir -r requirements.txt && \
30
+ echo "All requirements installed successfully"
31
 
32
  # Pre-download the lightweight embedding model to avoid timeout at startup
33
+ RUN python -c "from sentence_transformers import SentenceTransformer; print('Downloading model...'); SentenceTransformer('all-MiniLM-L6-v2'); print('Model downloaded!')"
34
 
35
  # Copy application files
36
  COPY --chown=user . .
 
41
  # Set environment variables
42
  ENV PYTHONUNBUFFERED=1
43
  ENV SPACE_ID=1
 
 
44
 
45
  # Expose port for Streamlit (HuggingFace Spaces uses 7860)
46
  EXPOSE 7860
47
 
48
+ # No healthcheck - let HF Spaces handle it
49
+ # Run Streamlit with logging
50
+ CMD ["streamlit", "run", "streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false", "--logger.level=info"]
 
 
 
requirements.txt CHANGED
@@ -9,7 +9,7 @@ openai>=1.12.0
9
  # Embeddings and Vector Store
10
  sentence-transformers>=2.2.0
11
  transformers>=4.35.0
12
- torch
13
  chromadb>=0.4.0
14
  qdrant-client>=1.7.0
15
 
 
9
  # Embeddings and Vector Store
10
  sentence-transformers>=2.2.0
11
  transformers>=4.35.0
12
+ # torch installed separately in Dockerfile with CPU-only version
13
  chromadb>=0.4.0
14
  qdrant-client>=1.7.0
15