ChatBotsTA commited on
Commit
771ab5d
·
verified ·
1 Parent(s): 1694610

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +32 -4
Dockerfile CHANGED
@@ -1,14 +1,42 @@
 
1
  FROM python:3.10-slim
2
 
 
3
  WORKDIR /app
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  COPY requirements.txt .
6
  RUN pip install --no-cache-dir -r requirements.txt
7
 
8
- COPY app.py .
 
 
9
 
10
- ENV STREAMLIT_SERVER_ENABLE_CORS=false
11
- ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
12
 
 
13
  EXPOSE 8501
14
- CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
 
 
 
 
 
1
+ # Use a slim Python base
2
  FROM python:3.10-slim
3
 
4
+ # Set working directory
5
  WORKDIR /app
6
 
7
+ # Streamlit runtime env (sane defaults)
8
+ ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
9
+ ENV STREAMLIT_SERVER_ENABLE_CORS=false
10
+ ENV STREAMLIT_SERVER_HEADLESS=true
11
+ ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
12
+ ENV STREAMLIT_SERVER_PORT=8501
13
+ ENV STREAMLIT_SERVER_MAX_UPLOAD_SIZE=200 # MB
14
+
15
+ # Install small set of system deps needed for pillow/pdf parsing
16
+ RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ build-essential \
18
+ libjpeg-dev \
19
+ zlib1g-dev \
20
+ git \
21
+ curl \
22
+ && rm -rf /var/lib/apt/lists/*
23
+
24
+ # Copy requirements and install python deps
25
  COPY requirements.txt .
26
  RUN pip install --no-cache-dir -r requirements.txt
27
 
28
+ # Create .streamlit config (ensures flags applied in the container)
29
+ RUN mkdir -p /app/.streamlit \
30
+ && cat > /app/.streamlit/config.toml <<'EOF'\n[server]\nheadless = true\nenableXsrfProtection = false\nenableCORS = false\naddress = "0.0.0.0"\nport = 8501\nmaxUploadSize = 200\nEOF
31
 
32
+ # Copy app (your Streamlit app file)
33
+ COPY app.py .
34
 
35
+ # Expose port and run Streamlit with explicit flags (override safe)
36
  EXPOSE 8501
37
+ CMD ["streamlit", "run", "app.py", \
38
+ "--server.enableXsrfProtection=false", \
39
+ "--server.enableCORS=false", \
40
+ "--server.headless=true", \
41
+ "--server.address=0.0.0.0", \
42
+ "--server.port=8501"]