Skip to content

Commit 6fb7cc6

Browse files
committed
modernize Dockerfile to work with openshift
1 parent 1f39981 commit 6fb7cc6

1 file changed

Lines changed: 16 additions & 12 deletions

File tree

Dockerfile

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
1-
FROM python:3.11
1+
FROM docker.io/python:3.11-slim AS base
2+
ENV LANG=C.UTF-8
3+
ENV LC_ALL=C.UTF-8
4+
ENV PYTHONDONTWRITEBYTECODE=1
5+
ENV PYTHONFAULTHANDLER=1
26

3-
RUN useradd -u 65532 -d /app -m appuser
4-
USER 65532
5-
6-
WORKDIR /app
7+
FROM base AS builder
8+
RUN pip install pipenv
9+
COPY Pipfile* ./
10+
RUN PIPENV_VENV_IN_PROJECT=1 pipenv install --deploy
711

8-
COPY Pipfile* *.py LICENSE /app/
9-
10-
RUN pip install --no-cache-dir pipenv
11-
RUN /app/.local/bin/pipenv install --system --deploy
12-
# Maybe "pipenv sync" would be better. I'm unsure:
13-
# https://pipenv-fork.readthedocs.io/en/latest/advanced.html#using-pipenv-for-deployments
12+
FROM base
13+
RUN adduser --uid 65532 nonroot
14+
COPY --from=builder /.venv /.venv
15+
ENV PATH="/.venv/bin:$PATH"
16+
COPY *.py LICENSE ./
1417

1518
EXPOSE 8080 9090
19+
USER 65532
1620
ENV prometheus_multiproc_dir=/tmp
17-
CMD ["/app/.local/bin/gunicorn", "-c", "gunicorn_conf.py", "server:app"]
21+
ENTRYPOINT ["/app/.local/bin/gunicorn", "-c", "gunicorn_conf.py", "server:app"]

0 commit comments

Comments
 (0)