File size: 1,359 Bytes
771ab5d
bfc1bdb
0f11427
771ab5d
0f11427
17e0e64
771ab5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bfc1bdb
 
0f11427
771ab5d
 
 
0f11427
771ab5d
 
0f11427
771ab5d
0f11427
771ab5d
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Use a slim Python base
FROM python:3.10-slim

# Set working directory
WORKDIR /app

# Streamlit runtime env (sane defaults)
ENV STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false
ENV STREAMLIT_SERVER_ENABLE_CORS=false
ENV STREAMLIT_SERVER_HEADLESS=true
ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0
ENV STREAMLIT_SERVER_PORT=8501
ENV STREAMLIT_SERVER_MAX_UPLOAD_SIZE=200  # MB

# Install small set of system deps needed for pillow/pdf parsing
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    libjpeg-dev \
    zlib1g-dev \
    git \
    curl \
  && rm -rf /var/lib/apt/lists/*

# Copy requirements and install python deps
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Create .streamlit config (ensures flags applied in the container)
RUN mkdir -p /app/.streamlit \
 && cat > /app/.streamlit/config.toml <<'EOF'\n[server]\nheadless = true\nenableXsrfProtection = false\nenableCORS = false\naddress = "0.0.0.0"\nport = 8501\nmaxUploadSize = 200\nEOF

# Copy app (your Streamlit app file)
COPY app.py .

# Expose port and run Streamlit with explicit flags (override safe)
EXPOSE 8501
CMD ["streamlit", "run", "app.py", \
     "--server.enableXsrfProtection=false", \
     "--server.enableCORS=false", \
     "--server.headless=true", \
     "--server.address=0.0.0.0", \
     "--server.port=8501"]