File size: 1,260 Bytes
9b4bb17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c7ae96b
 
 
 
9b4bb17
 
 
c7ae96b
 
 
 
 
9b4bb17
 
 
c7ae96b
9b4bb17
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Use a high-quality Python image
FROM python:3.11-slim

# Install system dependencies (git for cloning repos)
RUN apt-get update && apt-get install -y \
    git \
    && rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /app

# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# --- Pre-download Embedding Models to cache them in the Docker image ---
# This ensures the app boots instantly and doesn't get stuck in 'Starting...'
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('all-MiniLM-L6-v2'); SentenceTransformer('intfloat/e5-small-v2')"

# Copy the rest of the application
COPY . .

# Environment variables for performance and avoiding telemetry issues
ENV CHROMA_TELEMETRY_NO_ANALYTICS=True
ENV ANONYMIZED_TELEMETRY=False
ENV STREAMLIT_SERVER_HEADLESS=true

# Create dummy db_store for local testing during build if needed
RUN mkdir -p db_store

# Set permissions for Hugging Face (any user can write)
RUN chmod -R 777 /app

# Expose Streamlit's default port
EXPOSE 7860

# Command to run the application (Hugging Face expects port 7860)
CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]