AnirudhEsthuri-MV commited on
Commit
98b6550
·
1 Parent(s): 233cef2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +41 -5
Dockerfile CHANGED
@@ -1,14 +1,50 @@
1
- FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y git
6
-
7
- COPY . .
 
 
 
 
8
 
 
9
  RUN pip install --upgrade pip
10
- RUN pip install -r requirements.txt
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  EXPOSE 7860
13
 
 
 
 
 
 
14
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]
 
1
+ FROM python:3.12-slim
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
+ # Install system dependencies
7
+ RUN apt-get update && \
8
+ apt-get install -y --no-install-recommends \
9
+ git \
10
+ curl \
11
+ && apt-get clean \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Upgrade pip
15
  RUN pip install --upgrade pip
 
16
 
17
+ # Copy requirements first for better caching
18
+ COPY requirements.txt .
19
+
20
+ # Install Python dependencies
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Copy all application files
24
+ COPY app.py .
25
+ COPY gateway_client.py .
26
+ COPY llm.py .
27
+ COPY model_config.py .
28
+ COPY styles.css .
29
+
30
+ # Copy assets directory
31
+ COPY assets/ ./assets/
32
+
33
+ # Copy Streamlit configuration
34
+ COPY .streamlit/ .streamlit/
35
+
36
+ # Set environment variables for Streamlit
37
+ ENV STREAMLIT_SERVER_PORT=7860
38
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
39
+ ENV STREAMLIT_SERVER_HEADLESS=true
40
+ ENV STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
41
+
42
+ # Expose port 7860 (required for Hugging Face Spaces)
43
  EXPOSE 7860
44
 
45
+ # Health check
46
+ HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
47
+ CMD curl --fail http://localhost:7860/_stcore/health || exit 1
48
+
49
+ # Run Streamlit app
50
  CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0", "--server.headless=true"]