aadhavans commited on
Commit
d593141
·
1 Parent(s): 071e8b9

Adding config execution to Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +11 -8
Dockerfile CHANGED
@@ -10,29 +10,32 @@ RUN apt-get update && apt-get install -y \
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
- # Copy and install Python dependencies
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  # Copy project files
18
  COPY . .
19
 
20
- # Create writable config/cache dirs
21
- RUN mkdir -p /app/.streamlit /app/.config/matplotlib
 
22
 
23
- # Copy Streamlit config to writable location
24
  COPY .streamlit/config.toml /app/.streamlit/config.toml
25
 
26
- # Set environment variables so Streamlit & Matplotlib use writable dirs
27
  ENV STREAMLIT_CONFIG_PATH=/app/.streamlit/config.toml \
28
  STREAMLIT_RUNTIME_DIR=/app/.streamlit \
29
- MPLCONFIGDIR=/app/.config/matplotlib
 
 
30
 
31
- # Expose port for Streamlit
32
  EXPOSE 8501
33
 
34
  # Healthcheck
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
36
 
37
  # Run Streamlit
38
- ENTRYPOINT ["streamlit", "run", "KPI_Dashboard.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
10
  git \
11
  && rm -rf /var/lib/apt/lists/*
12
 
13
+ # Copy Python dependencies
14
  COPY requirements.txt .
15
  RUN pip install --no-cache-dir -r requirements.txt
16
 
17
  # Copy project files
18
  COPY . .
19
 
20
+ # Create writable config/cache dirs and give full permissions
21
+ RUN mkdir -p /app/.streamlit /app/.config/matplotlib /app/.cache \
22
+ && chmod -R 777 /app/.streamlit /app/.config /app/.cache /tmp
23
 
24
+ # Copy your Streamlit config into writable directory
25
  COPY .streamlit/config.toml /app/.streamlit/config.toml
26
 
27
+ # Environment variables to redirect all writes to writable dirs
28
  ENV STREAMLIT_CONFIG_PATH=/app/.streamlit/config.toml \
29
  STREAMLIT_RUNTIME_DIR=/app/.streamlit \
30
+ STREAMLIT_CACHE_DIR=/app/.cache \
31
+ MPLCONFIGDIR=/app/.config/matplotlib \
32
+ HOME=/app
33
 
34
+ # Expose port
35
  EXPOSE 8501
36
 
37
  # Healthcheck
38
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1
39
 
40
  # Run Streamlit
41
+ ENTRYPOINT ["streamlit", "run", "KPI_Dashboard.py", "--server.port=8501", "--server.address=0.0.0.0"]