-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (39 loc) · 1.53 KB
/
Dockerfile
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
44
45
46
47
48
49
# https://docs.streamlit.io/deploy/tutorials/docker
# Docker image
FROM python:3.12-slim
# Update OS and install packages
RUN apt-get update && apt-get install -y \
build-essential curl software-properties-common \
&& rm -rf /var/lib/apt/lists/*
# create virtual environment and prepend its bin dir in $PATH
ENV VIRTUAL_ENV=/opt/venv
RUN python3 -m venv $VIRTUAL_ENV
ENV PATH="${VIRTUAL_ENV}/bin:${PATH}" \
# Allow statements and log messages to immediately appear in logs
PYTHONUNBUFFERED=1
# set the container's working directory
WORKDIR /src
# copy requirements file and install dependencies
COPY ./requirements.txt .
RUN pip install --upgrade pip && \
pip install --no-cache-dir --upgrade -r requirements.txt
# copy all the necessary app files into the working dir
COPY ./run.py ./
COPY ./app ./app
# streamlit config options
# https://docs.streamlit.io/develop/concepts/configuration/options
# https://docs.streamlit.io/develop/api-reference/configuration/config.toml
ENV PORT=8000
ENV STREAMLIT_CLIENT_SHOW_ERROR_DETAILS=false \
STREAMLIT_CLIENT_TOOLBAR_MODE=minimal \
STREAMLIT_SERVER_FILE_WATCHER_TYPE=none \
STREAMLIT_SERVER_HEADLESS=true \
STREAMLIT_SERVER_RUN_ON_SAVE=false \
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
STREAMLIT_SERVER_PORT=$PORT \
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
EXPOSE $PORT
# https://docs.docker.com/reference/dockerfile/#healthcheck
HEALTHCHECK CMD curl --fail http://localhost:${STREAMLIT_SERVER_PORT}/_stcore/health
# command to run the streamlit app
CMD streamlit run run.py