This repository was archived by the owner on Nov 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
53 lines (39 loc) · 1.39 KB
/
Dockerfile
File metadata and controls
53 lines (39 loc) · 1.39 KB
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
50
51
52
53
ARG PYTHON_BASE=3.10-slim
FROM docker.io/python:$PYTHON_BASE AS builder
# Install PDM
RUN pip install -U pdm
# Disable update check
ENV PDM_CHECK_UPDATE=false
# Copy necessary files for dependency installation
COPY pyproject.toml pdm.lock README.md /project/
COPY src/ /project/src
# Set the working directory
WORKDIR /project
# Install dependencies and project into the local packages directory
RUN pdm install --check --prod --no-editable
FROM docker.io/python:$PYTHON_BASE
ARG TINI_VERSION="v0.19.0"
ARG STREAMLIT_PORT=8501
ARG GIT_HASH
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
RUN set -eux; \
apt-get update; \
apt-get install -y --no-install-recommends gosu; \
rm -rf /var/lib/apt/lists/*; \
chmod +x /tini;
ENV PATH="/project/.venv/bin:$PATH"
ENV GIT_HASH=${GIT_HASH:-dev}
ENV STREAMLIT_PORT=${STREAMLIT_PORT}
ENV DATABASE_URL="sqlite:///data/tmvis.db"
ENV MAINTENANCE_MODE="false"
ENV LOG_LEVEL="ERROR"
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
COPY --from=builder /project/.venv/ /project/.venv
COPY src /project/src
COPY assets /project/assets
WORKDIR /project
EXPOSE ${STREAMLIT_PORT}
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["/tini", "--", "/entrypoint.sh"]
CMD ["sh", "-c", "streamlit run src/streamlitapp.py --browser.gatherUsageStats=false --server.port=${STREAMLIT_PORT} --server.address=0.0.0.0"]