File size: 944 Bytes
10eeb8b
44a6d44
27e770e
44a6d44
27e770e
 
 
 
44a6d44
 
27e770e
 
 
 
 
 
44a6d44
27e770e
 
44a6d44
 
27e770e
 
 
 
 
 
 
 
 
5148618
44a6d44
 
 
5148618
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
FROM python:3.11.9-slim

# 1) System deps
RUN apt-get update && apt-get install -y \
      build-essential \
      curl \
      software-properties-common \
      git \
    && rm -rf /var/lib/apt/lists/*

# 2) Create app user with home dir
RUN useradd -m -u 10001 -s /usr/sbin/nologin appuser

WORKDIR /app
# Make sure /app is owned by our user
RUN chown appuser:appuser /app

# 3) Copy & install Python deps as root
COPY requirements.txt .
RUN pip3 install -r requirements.txt

# 4) Copy your source & switch to non‑root
COPY src/ ./src/
USER appuser

# 5) Ensure Streamlit config dir exists in the new home
ENV HOME=/home/appuser \
    STREAMLIT_DATA_DIR=/home/appuser/.streamlit \
    XDG_CONFIG_HOME=/home/appuser/.streamlit
RUN mkdir -p /home/appuser/.streamlit

EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

ENTRYPOINT ["streamlit", "run", "src/app.py", "--server.port=8501", "--server.address=0.0.0.0"]