Abhishek Kumar commited on
Commit
8ec847b
·
1 Parent(s): 371de80

Fix Streamlit permissions by moving config directory to /app/.streamlit

Browse files
Files changed (1) hide show
  1. Dockerfile +14 -14
Dockerfile CHANGED
@@ -2,23 +2,23 @@ FROM python:3.9-slim
2
 
3
  WORKDIR /app
4
 
5
- RUN mkdir -p /root/.streamlit && \
6
- chmod 777 /root/.streamlit
 
7
 
8
- RUN apt-get update && apt-get install -y \
9
- build-essential \
10
- curl \
11
- software-properties-common \
12
- git \
13
- && rm -rf /var/lib/apt/lists/*
14
 
15
- COPY requirements.txt ./
16
- COPY src/ ./src/
17
 
18
- RUN pip3 install -r requirements.txt
 
 
 
19
 
20
  EXPOSE 8501
21
 
22
- HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
23
-
24
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
2
 
3
  WORKDIR /app
4
 
5
+ # Create directories and set permissions
6
+ RUN mkdir -p /app/.streamlit && \
7
+ chmod 777 /app/.streamlit
8
 
9
+ # Copy requirements first for better caching
10
+ COPY requirements.txt .
11
+ RUN pip install --no-cache-dir -r requirements.txt
 
 
 
12
 
13
+ # Copy the rest of the application
14
+ COPY . .
15
 
16
+ # Set environment variables
17
+ ENV STREAMLIT_SERVER_PORT=8501
18
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
19
+ ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
20
 
21
  EXPOSE 8501
22
 
23
+ # Run Streamlit
24
+ CMD ["streamlit", "run", "src/streamlit_app.py"]