Luigi commited on
Commit
6242c02
·
verified ·
1 Parent(s): 2314457

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +22 -7
Dockerfile CHANGED
@@ -12,19 +12,31 @@ RUN apt-get update && apt-get install -y \
12
  libopenblas-dev \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
- # === FIX PERMISSION ERRORS ===
16
- # Set writable cache/config paths for Streamlit, Hugging Face, and Matplotlib
17
- ENV HF_HOME=/tmp/huggingface
 
18
  ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit
 
19
 
20
- # Create those directories and make them writable
21
  RUN mkdir -p /tmp/.streamlit /tmp/huggingface && \
22
- chmod -R 777 /tmp/.streamlit /tmp/huggingface
23
 
24
  # Copy files
25
  COPY requirements.txt ./
26
  COPY src/ ./src/
27
- COPY .streamlit/ /tmp/.streamlit/
 
 
 
 
 
 
 
 
 
 
28
 
29
  # Install Python dependencies
30
  RUN pip3 install --no-cache-dir -r requirements.txt
@@ -33,4 +45,7 @@ EXPOSE 8501
33
 
34
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
35
 
36
- ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
12
  libopenblas-dev \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # === CRITICAL FIX ===
16
+ # Set Streamlit to use temporary directories for ALL storage
17
+ ENV STREAMLIT_GLOBAL_DEVELOPMENT_MODE=false
18
+ ENV STREAMLIT_GLOBAL_DATA_PATH=/tmp
19
  ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit
20
+ ENV HF_HOME=/tmp/huggingface
21
 
22
+ # Create directories with open permissions
23
  RUN mkdir -p /tmp/.streamlit /tmp/huggingface && \
24
+ chmod -R 777 /tmp
25
 
26
  # Copy files
27
  COPY requirements.txt ./
28
  COPY src/ ./src/
29
+
30
+ # Create config file directly in Dockerfile
31
+ RUN echo $'[global]\n\
32
+ dataSavePath = "/tmp"\n\
33
+ \n\
34
+ [browser]\n\
35
+ gatherUsageStats = false\n\
36
+ \n\
37
+ [server]\n\
38
+ enableCORS = false\n\
39
+ enableXsrfProtection = false' > /tmp/.streamlit/config.toml
40
 
41
  # Install Python dependencies
42
  RUN pip3 install --no-cache-dir -r requirements.txt
 
45
 
46
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
47
 
48
+ ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \
49
+ "--global.dataPath=/tmp", \
50
+ "--server.port=8501", \
51
+ "--server.address=0.0.0.0"]