nnsohamnn commited on
Commit
c7ae96b
·
1 Parent(s): e0bc5ed

feat: pre-download and cache embedding models in Docker image for faster startup

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -1
Dockerfile CHANGED
@@ -13,13 +13,22 @@ WORKDIR /app
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
 
 
 
 
16
  # Copy the rest of the application
17
  COPY . .
18
 
 
 
 
 
 
19
  # Create dummy db_store for local testing during build if needed
20
  RUN mkdir -p db_store
21
 
22
- # Set permissions for Hugging Face
23
  RUN chmod -R 777 /app
24
 
25
  # Expose Streamlit's default port
 
13
  COPY requirements.txt .
14
  RUN pip install --no-cache-dir -r requirements.txt
15
 
16
+ # --- Pre-download Embedding Models to cache them in the Docker image ---
17
+ # This ensures the app boots instantly and doesn't get stuck in 'Starting...'
18
+ RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2'); SentenceTransformer('intfloat/e5-small-v2')"
19
+
20
  # Copy the rest of the application
21
  COPY . .
22
 
23
+ # Environment variables for performance and avoiding telemetry issues
24
+ ENV CHROMA_TELEMETRY_NO_ANALYTICS=True
25
+ ENV ANONYMIZED_TELEMETRY=False
26
+ ENV STREAMLIT_SERVER_HEADLESS=true
27
+
28
  # Create dummy db_store for local testing during build if needed
29
  RUN mkdir -p db_store
30
 
31
+ # Set permissions for Hugging Face (any user can write)
32
  RUN chmod -R 777 /app
33
 
34
  # Expose Streamlit's default port