WaysAhead Global commited on
Commit
a464c43
·
verified ·
1 Parent(s): 0df38e3

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +20 -3
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 src/ ./src/
14
 
15
- RUN pip3 install -r requirements.txt
 
16
 
 
17
  EXPOSE 8501
18
 
19
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
20
 
21
- 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
+ # Install dependencies and required packages
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
10
  software-properties-common \
11
  git \
12
+ libspatialindex-dev \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # Create necessary writeable directories
16
+ RUN mkdir -p /app/.streamlit /root/.cache && chmod -R 777 /app /root/.cache
17
+
18
+ # Set environment variables to avoid permission issues
19
+ ENV STREAMLIT_HOME=/app/.streamlit \
20
+ OSMNX_CACHE_FOLDER=/root/.cache/osmnx \
21
+ MPLCONFIGDIR=/root/.cache/matplotlib \
22
+ PYTHONUNBUFFERED=1
23
+
24
+ # Copy project files
25
  COPY requirements.txt ./
26
  COPY src/ ./src/
27
 
28
+ # Install Python dependencies
29
+ RUN pip3 install --upgrade pip && pip3 install -r requirements.txt
30
 
31
+ # Expose default Streamlit port
32
  EXPOSE 8501
33
 
34
+ # Health check for container monitoring
35
+ HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
36
 
37
+ # Start the Streamlit app
38
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]