Lokiiparihar commited on
Commit
68fc041
·
verified ·
1 Parent(s): db18adf

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -5
Dockerfile CHANGED
@@ -1,22 +1,24 @@
1
  FROM python:3.9-slim
2
 
 
3
  WORKDIR /app
4
 
5
- # Set a safe HOME and streamlit config directory
6
  ENV HOME=/app
7
  ENV STREAMLIT_HOME=/app/.streamlit
8
 
 
9
  RUN apt-get update && apt-get install -y \
10
  build-essential \
11
  curl \
12
- software-properties-common \
13
  git \
14
  && rm -rf /var/lib/apt/lists/*
15
 
 
16
  COPY requirements.txt ./
17
  COPY src/ ./src/
18
 
19
- # Create .streamlit directory and basic config
20
  RUN mkdir -p $STREAMLIT_HOME && \
21
  echo "\
22
  [server]\n\
@@ -26,12 +28,17 @@ enableCORS = false\n\
26
  \n\
27
  [theme]\n\
28
  base = 'light'\n\
29
- " > $STREAMLIT_HOME/config.toml
 
30
 
31
- RUN pip3 install -r requirements.txt
 
32
 
 
33
  EXPOSE 8501
34
 
 
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
 
 
37
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
  FROM python:3.9-slim
2
 
3
+ # Set working directory
4
  WORKDIR /app
5
 
6
+ # Set safe home and Streamlit config path
7
  ENV HOME=/app
8
  ENV STREAMLIT_HOME=/app/.streamlit
9
 
10
+ # Install dependencies
11
  RUN apt-get update && apt-get install -y \
12
  build-essential \
13
  curl \
 
14
  git \
15
  && rm -rf /var/lib/apt/lists/*
16
 
17
+ # Copy files
18
  COPY requirements.txt ./
19
  COPY src/ ./src/
20
 
21
+ # Create .streamlit directory and config files before install
22
  RUN mkdir -p $STREAMLIT_HOME && \
23
  echo "\
24
  [server]\n\
 
28
  \n\
29
  [theme]\n\
30
  base = 'light'\n\
31
+ " > $STREAMLIT_HOME/config.toml && \
32
+ touch $STREAMLIT_HOME/machine_id_v4 # ensure file exists
33
 
34
+ # Install Python dependencies
35
+ RUN pip3 install --no-cache-dir -r requirements.txt
36
 
37
+ # Expose port
38
  EXPOSE 8501
39
 
40
+ # Health check
41
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
42
 
43
+ # Entrypoint to run app
44
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]