dcata004 commited on
Commit
2951e55
·
verified ·
1 Parent(s): 8e9c81f

Create Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +24 -6
Dockerfile CHANGED
@@ -1,20 +1,38 @@
1
- FROM python:3.13.5-slim
 
 
2
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  curl \
 
8
  git \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- COPY requirements.txt ./
12
- COPY src/ ./src/
 
 
 
13
 
14
- RUN pip3 install -r requirements.txt
 
15
 
 
16
  EXPOSE 8501
17
 
18
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
19
 
20
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
1
+ # Use the official lightweight Python image.
2
+ # "Slim" keeps the file size down (better for cloud costs).
3
+ FROM python:3.9-slim
4
 
5
+ # Set the working directory inside the container
6
  WORKDIR /app
7
 
8
+ # Prevent Python from writing pyc files to disc (useless in containers)
9
+ ENV PYTHONDONTWRITEBYTECODE=1
10
+ # Prevent Python from buffering stdout/stderr (so you see logs immediately)
11
+ ENV PYTHONUNBUFFERED=1
12
+
13
+ # Install system dependencies (sometimes needed for Plotly/Pandas)
14
  RUN apt-get update && apt-get install -y \
15
  build-essential \
16
  curl \
17
+ software-properties-common \
18
  git \
19
  && rm -rf /var/lib/apt/lists/*
20
 
21
+ # Copy the requirements file first (for better caching)
22
+ COPY requirements.txt .
23
+
24
+ # Install Python dependencies
25
+ RUN pip3 install --no-cache-dir -r requirements.txt
26
 
27
+ # Copy the rest of the application code
28
+ COPY . .
29
 
30
+ # Expose the port Streamlit runs on
31
  EXPOSE 8501
32
 
33
+ # The Healthcheck (Critical for "High Availability" systems)
34
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
35
 
36
+ # Command to run the app
37
+ # address=0.0.0.0 is MANDATORY for Docker
38
+ ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]