File size: 1,536 Bytes
1733b93
 
323ef01
1733b93
 
 
 
 
 
 
323ef01
1733b93
323ef01
 
1733b93
 
 
 
 
 
 
 
323ef01
1733b93
 
 
 
 
 
 
323ef01
1733b93
 
 
 
 
323ef01
 
1733b93
 
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
# Use Python 3.10 to match your Azure env
FROM python:3.10-slim

# --- Create non-root user -----------------------------------------------------
RUN useradd -m -u 1000 user
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1
WORKDIR $HOME/app

# --- Copy requirements first for caching -------------------------------------
COPY requirements.txt ./

# --- Install OS dependencies --------------------------------------------------
USER root
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --no-install-recommends \
      curl \
      git \
      build-essential \
  && rm -rf /var/lib/apt/lists/*

# --- Install Python dependencies ---------------------------------------------
RUN python -m pip install --upgrade pip \
 && python -m pip install -r requirements.txt \
 && python -m streamlit --version

# --- Copy application code ----------------------------------------------------
COPY --chown=user . $HOME/app

# --- Switch to non-root user --------------------------------------------------
USER user

# --- Configure Streamlit server ----------------------------------------------
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health

# --- Launch the Streamlit app -------------------------------------------------
ENTRYPOINT ["python", "-m", "streamlit", "run", "src/streamlit_app.py",  "--server.port=8501",  "--server.address=0.0.0.0",  "--server.headless=true",  "--server.enableXsrfProtection=false"]