-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathContainerfile
30 lines (25 loc) · 1.09 KB
/
Containerfile
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
FROM registry.access.redhat.com/ubi9/python-311:latest
USER root
# Install System Dependencies
ENV DNF_OPTS="--setopt=install_weak_deps=False --setopt=tsflags=nodocs"
RUN dnf update -y && \
dnf install -y ${DNF_OPTS} \
python3-pip \
&& dnf clean all -y
# Install PDM
# Use the system environment so the provided virtual environment can be re-used later
# without clashing with PDM and its dependencies
RUN /usr/bin/pip3 install --no-cache-dir pdm
USER default
# Provision the Virtual Environment
# First install all of the dependencies, not including the application itself.
# Reuses venv shipped with the ubi9/python-311 builder image.
COPY pyproject.toml pdm.lock README.md ./
RUN pdm use -if $APP_ROOT && pdm sync --prod --no-self
# Then add the application source. Doing things in this order prevents having to
# reprovision the entire virtual environment layer for source code changes.
COPY src/ src/
# TODO: allow -G groups to be configured through build args to produce image variants
RUN pdm use -if $APP_ROOT && pdm sync -G aws --prod
ENV PYTHONUNBUFFERED=1
ENTRYPOINT ["bowser"]