euler314 commited on
Commit
ef64d6b
·
verified ·
1 Parent(s): 47721ea

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -0
Dockerfile ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use a slim Python base image
2
+ FROM python:3.9-slim
3
+
4
+ # Set working directory
5
+ WORKDIR /app
6
+
7
+ # Install system dependencies
8
+ RUN apt-get update && apt-get install -y \
9
+ build-essential \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Copy requirements first to leverage Docker cache
13
+ COPY requirements.txt .
14
+
15
+ # Install Python dependencies
16
+ RUN pip install --no-cache-dir -r requirements.txt
17
+
18
+ # Copy the application code
19
+ COPY app.py .
20
+
21
+ # Expose the port Streamlit runs on
22
+ EXPOSE 8501
23
+
24
+ # Set environment variable to make Streamlit accessible externally
25
+ ENV STREAMLIT_SERVER_PORT=8501
26
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
27
+
28
+ # Health check
29
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
30
+
31
+ # Run the application
32
+ CMD ["streamlit", "run", "app.py"]