File size: 1,299 Bytes
33558c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.12.11-slim

# ---------- System packages ----------
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential curl git chromium chromium-driver fonts-liberation libgbm1 \
    && rm -rf /var/lib/apt/lists/*

# ---------- Non-root user ----------
RUN useradd -m -u 1000 appuser
USER appuser

# ---------- Workdir ----------
WORKDIR /app

# ---------- Environment ----------
ENV HOME=/app \
    STREAMLIT_CONFIG_DIR=/app/.streamlit \
    XDG_CACHE_HOME=/app/.cache \
    HF_HOME=/app/.cache/huggingface \
    STREAMLIT_BROWSER_GATHERUSAGESTATS=false \
    STREAMLIT_CLI_DISABLE_USAGE_STATS=true \
    PATH="/app/.local/bin:$PATH" \
    CHROME_BIN=/usr/bin/chromium \
    CHROMEDRIVER_PATH=/usr/bin/chromedriver

RUN mkdir -p /app/.streamlit /app/.cache/huggingface/hub

# ---------- Python deps ----------
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# ---------- App code ----------
COPY streamlit_app.py ./streamlit_app.py

# ---------- Health & expose ----------
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

# ---------- Start ----------
ENTRYPOINT ["streamlit", "run", "streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0", "--server.enableXsrfProtection=false"]