dcata004 commited on
Commit
5022346
·
verified ·
1 Parent(s): 1fbcb49

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -14
Dockerfile CHANGED
@@ -1,38 +1,34 @@
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"]
 
1
+ # Use python:3.9-slim for speed
 
2
  FROM python:3.9-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Set environment variables to keep Python logs clean
8
  ENV PYTHONDONTWRITEBYTECODE=1
 
9
  ENV PYTHONUNBUFFERED=1
10
 
11
+ # Install ONLY the essentials (curl for healthcheck, build-essential for compiling)
12
+ # We removed 'software-properties-common' and 'git' to fix the build error.
13
  RUN apt-get update && apt-get install -y \
14
  build-essential \
15
  curl \
 
 
16
  && rm -rf /var/lib/apt/lists/*
17
 
18
+ # Copy requirements first to leverage Docker caching
19
  COPY requirements.txt .
20
 
21
  # Install Python dependencies
22
  RUN pip3 install --no-cache-dir -r requirements.txt
23
 
24
+ # Copy the rest of the application
25
  COPY . .
26
 
27
+ # Expose Streamlit port
28
  EXPOSE 8501
29
 
30
+ # Healthcheck to keep the app alive
31
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
32
 
33
+ # Run the app
 
34
  ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]