NavyDevilDoc commited on
Commit
c6a4cf3
·
verified ·
1 Parent(s): d194098

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +31 -0
Dockerfile ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use an official lightweight Python image.
2
+ # 3.11 is stable and faster than previous versions.
3
+ FROM python:3.11-slim
4
+
5
+ # Set environment variables
6
+ # PYTHONDONTWRITEBYTECODE: Prevents Python from writing pyc files to disc
7
+ # PYTHONUNBUFFERED: Prevents Python from buffering stdout and stderr
8
+ ENV PYTHONDONTWRITEBYTECODE=1
9
+ ENV PYTHONUNBUFFERED=1
10
+
11
+ # Set the working directory in the container
12
+ WORKDIR /app
13
+
14
+ # Copy the requirements file first to leverage Docker cache
15
+ COPY requirements.txt .
16
+
17
+ # Install dependencies
18
+ RUN pip install --no-cache-dir -r requirements.txt
19
+
20
+ # Copy the rest of the application code
21
+ COPY . .
22
+
23
+ # Expose the port Streamlit runs on
24
+ EXPOSE 7860
25
+
26
+ # Healthcheck to ensure the container is responsive
27
+ HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
28
+
29
+ # Command to run the application
30
+ # server.address=0.0.0.0 is crucial for Docker networking
31
+ CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.enableCORS=false", "--server.enableXsrfProtection=false"]