bharathmunakala commited on
Commit
56df456
·
verified ·
1 Parent(s): 09aaa15

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -6
Dockerfile CHANGED
@@ -1,21 +1,38 @@
1
- FROM python:3.9-slim
 
2
 
 
3
  WORKDIR /app
4
 
5
- RUN apt-get update && apt-get install -y \
 
 
 
 
 
 
 
 
6
  build-essential \
7
  curl \
8
- software-properties-common \
9
  git \
 
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
12
  COPY requirements.txt ./
13
- COPY . . # Copy all project files to /app
14
 
15
- RUN pip3 install --no-cache-dir -r requirements.txt
 
 
 
 
16
 
 
17
  EXPOSE 8501
18
 
 
19
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
20
 
21
- ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
1
+ # Use official Python image as base
2
+ FROM python:3.10-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Set environment variables
8
+ ENV PYTHONDONTWRITEBYTECODE=1 \
9
+ PYTHONUNBUFFERED=1 \
10
+ STREAMLIT_SERVER_PORT=8501 \
11
+ STREAMLIT_SERVER_HEADLESS=true \
12
+ STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
13
+
14
+ # Install system dependencies
15
+ RUN apt-get update && apt-get install -y --no-install-recommends \
16
  build-essential \
17
  curl \
 
18
  git \
19
+ software-properties-common \
20
  && rm -rf /var/lib/apt/lists/*
21
 
22
+ # Copy requirements first to leverage Docker cache
23
  COPY requirements.txt ./
 
24
 
25
+ # Install Python dependencies
26
+ RUN pip install --no-cache-dir -r requirements.txt
27
+
28
+ # Copy the rest of the application
29
+ COPY . .
30
 
31
+ # Expose the port Streamlit runs on
32
  EXPOSE 8501
33
 
34
+ # Healthcheck
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
36
 
37
+ # Command to run the application
38
+ CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]