mgbam commited on
Commit
eded179
·
verified ·
1 Parent(s): d9de983

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +6 -12
Dockerfile CHANGED
@@ -1,22 +1,22 @@
1
  FROM python:3.10-slim
2
 
3
- # Set environment variables so Streamlit uses a writable config directory
4
  ENV HOME=/app
5
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
6
 
7
  WORKDIR /app
8
 
9
- # Install dependencies
10
  COPY requirements.txt .
11
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
12
 
13
- # Copy all app code
14
  COPY . .
15
 
16
- # Create the .streamlit folder and make sure it’s writable by anyone
17
  RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
18
 
19
- # Add a default Streamlit config.toml if you don’t already provide one
20
  RUN echo "\
21
  [server]\n\
22
  headless = true\n\
@@ -24,15 +24,9 @@ port = 8501\n\
24
  address = \"0.0.0.0\"\n\
25
  enableCORS = false\n\
26
  enableXsrfProtection = false\n\
27
- \n\
28
- [theme]\n\
29
- primaryColor = \"#e63946\"\n\
30
- backgroundColor = \"#0E1117\"\n\
31
- secondaryBackgroundColor = \"#1a1a2e\"\n\
32
- textColor = \"#FAFAFA\"\n\
33
- font = \"sans serif\"\n\
34
  " > /app/.streamlit/config.toml
35
 
36
  EXPOSE 8501
37
 
 
38
  CMD streamlit run app.py --server.port=8501 --server.address=0.0.0.0
 
1
  FROM python:3.10-slim
2
 
3
+ # Ensure Streamlit writes to a writable directory
4
  ENV HOME=/app
5
  ENV STREAMLIT_CONFIG_DIR=/app/.streamlit
6
 
7
  WORKDIR /app
8
 
9
+ # Install production dependencies only
10
  COPY requirements.txt .
11
  RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt
12
 
13
+ # Copy codebase
14
  COPY . .
15
 
16
+ # Ensure config folder exists with correct permissions
17
  RUN mkdir -p /app/.streamlit && chmod -R 777 /app/.streamlit
18
 
19
+ # Add minimal Streamlit config
20
  RUN echo "\
21
  [server]\n\
22
  headless = true\n\
 
24
  address = \"0.0.0.0\"\n\
25
  enableCORS = false\n\
26
  enableXsrfProtection = false\n\
 
 
 
 
 
 
 
27
  " > /app/.streamlit/config.toml
28
 
29
  EXPOSE 8501
30
 
31
+ # Shell form CMD ensures log output compatibility on Spaces
32
  CMD streamlit run app.py --server.port=8501 --server.address=0.0.0.0