celik-muhammed commited on
Commit
4481256
·
verified ·
1 Parent(s): 28ca5a7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -1,17 +1,21 @@
 
1
  FROM python:3.11-slim
2
 
3
  # Set environment variables to avoid writing to root
4
- ENV HOME=/app
5
- ENV MPLCONFIGDIR=/tmp/.config/matplotlib
6
- ENV STREAMLIT_HOME=/tmp/.streamlit
7
  # Optional: Disable Usage Stats (telemetry) for Privacy / Stability
8
  ENV STREAMLIT_DISABLE_USAGE_STATS=true
9
 
10
- RUN mkdir -p /app/.streamlit /app/.config/matplotlib \
11
- && chmod -R 777 /app/.streamlit /app/.config
12
-
13
  WORKDIR /app
14
 
 
 
 
 
 
 
 
 
15
  # Install dependencies
16
  RUN apt-get update && apt-get install -y \
17
  build-essential \
@@ -31,7 +35,7 @@ RUN apt-get update && apt-get install -y \
31
  COPY requirements.txt ./
32
  COPY src/ ./src/
33
 
34
- # Install Python dependencies
35
  RUN pip3 install -r requirements.txt
36
 
37
  # Expose port
@@ -40,5 +44,5 @@ EXPOSE 8501
40
  # Health check
41
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
42
 
43
- # Entry point
44
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # Use official Python slim image
2
  FROM python:3.11-slim
3
 
4
  # Set environment variables to avoid writing to root
 
 
 
5
  # Optional: Disable Usage Stats (telemetry) for Privacy / Stability
6
  ENV STREAMLIT_DISABLE_USAGE_STATS=true
7
 
8
+ # Set working directory inside container
 
 
9
  WORKDIR /app
10
 
11
+ # Run as root user (default in python:3.11-slim), but confirm permission for /app
12
+ RUN chown -R root:root /app
13
+
14
+ # Ensure /app and cache/config directories exist with proper permissions
15
+ RUN chown -R root:root /app && \
16
+ mkdir -p /root/.cache /root/.config /root/.streamlit && \
17
+ chmod -R 777 /root/.cache /root/.config /root/.streamlit /app
18
+
19
  # Install dependencies
20
  RUN apt-get update && apt-get install -y \
21
  build-essential \
 
35
  COPY requirements.txt ./
36
  COPY src/ ./src/
37
 
38
+ # Install Python dependencies including streamlit
39
  RUN pip3 install -r requirements.txt
40
 
41
  # Expose port
 
44
  # Health check
45
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
46
 
47
+ # Run Streamlit with no browser, on all interfaces
48
  ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]