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

Changing Dockerfile to allow perms

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -21
Dockerfile CHANGED
@@ -1,41 +1,42 @@
 
1
  FROM python:3.9-slim
2
 
3
  # Set working directory
4
  WORKDIR /app
5
 
6
- # Install system dependencies
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
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"]
 
1
+ # Base image
2
  FROM python:3.9-slim
3
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install dependencies
8
  RUN apt-get update && apt-get install -y \
9
  build-essential \
10
  curl \
11
  git \
12
+ && rm -rf /var/lib/apt/lists/*
13
 
14
+ # Copy requirements and install Python packages
15
  COPY requirements.txt .
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
+ # Copy app source code
19
  COPY . .
20
 
21
+ # Create necessary folders with full permissions
22
+ RUN mkdir -p /app/.streamlit \
23
+ /app/.config/matplotlib \
24
+ /app/.cache \
25
+ /app/outputs \
26
+ && chmod -R 777 /app/.streamlit \
27
+ /app/.config \
28
+ /app/.cache \
29
+ /app/outputs \
30
+ /tmp
31
+
32
+ # Copy Streamlit config if you have one
33
  COPY .streamlit/config.toml /app/.streamlit/config.toml
34
 
35
+ # Set environment variable for Matplotlib to use writable directory
36
+ ENV MPLCONFIGDIR=/app/.config/matplotlib
 
 
 
 
37
 
38
+ # Expose Streamlit default port
39
  EXPOSE 8501
40
 
41
+ # Command to run Streamlit app
42
+ CMD ["streamlit", "run", "app.py"]