File size: 1,438 Bytes
f8da35d
e91e2b4
98b6550
e91e2b4
 
98b6550
 
 
 
 
 
 
e91e2b4
98b6550
e91e2b4
 
98b6550
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a56dead
 
200987b
e91e2b4
a56dead
98b6550
a56dead
98b6550
a56dead
a2c6cb7
d2e40af
8617ea0
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    git \
    curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Upgrade pip
RUN pip install --upgrade pip

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy all application files
COPY app.py .
COPY gateway_client.py .
COPY llm.py .
COPY model_config.py .
COPY styles.css .

# Copy assets directory
COPY assets/ ./assets/

# Copy Streamlit configuration
COPY .streamlit/ .streamlit/

# Set environment variables for Streamlit
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false

# HuggingFace Spaces provides $PORT environment variable
# Expose port (will be set by Hugging Face Spaces)
EXPOSE 7860

# Health check (uses PORT env var)
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
    CMD curl --fail http://localhost:${PORT:-7860}/_stcore/health || exit 1

# Run Streamlit app using PORT env var from Hugging Face Spaces
# HuggingFace sets $PORT, don't override it. Default to 7860 if not set.
# Try the main app now
CMD ["bash", "-c", "PORT=${PORT:-7860} && echo Using PORT=$PORT && streamlit run app.py --server.address=0.0.0.0 --server.port=$PORT"]