1- FROM python:3.9
1+ FROM ubuntu:jammy as build-image
2+
3+ RUN apt-get update && \
4+ apt-get upgrade -y && \
5+ apt-get install --no-install-recommends python3.10-venv git -y && \
6+ rm -rf /var/lib/apt/lists/*
7+
8+ # build into a venv we can copy across
9+ RUN python3 -m venv /opt/venv
10+ ENV PATH="/opt/venv/bin:$PATH"
11+
12+ COPY . /perftest
13+ RUN pip install -U pip setuptools
14+ RUN pip install --no-deps --requirement /perftest/requirements.txt
15+ RUN pip install -e /perftest
16+
17+ #
18+ # Now the image we run with
19+ #
20+ FROM ubuntu:jammy as run-image
21+
22+ RUN apt-get update && \
23+ apt-get upgrade -y && \
24+ apt-get install --no-install-recommends python3 tini ca-certificates -y && \
25+ rm -rf /var/lib/apt/lists/*
26+
27+ # Copy accross the venv
28+ COPY --from=build-image /opt/venv /opt/venv
29+ # Copy code to keep editable install working
30+ COPY . /perftest
31+ ENV PATH="/opt/venv/bin:$PATH"
232
333# Create the user that will be used to run the app
434ENV APP_UID 1001
@@ -22,14 +52,9 @@ RUN apt-get update && \
2252# Don't buffer stdout and stderr as it breaks realtime logging
2353ENV PYTHONUNBUFFERED 1
2454
25- # Install dependencies
26- # Doing this separately by copying only the requirements file enables better use of the build cache
27- COPY ./requirements.txt /perftest/
28- RUN pip install --no-deps --requirement /perftest/requirements.txt
29-
30- # Install the perftest package
31- COPY . /perftest
32- RUN pip install --no-deps -e /perftest
55+ # Make httpx use the system trust roots
56+ # By default, this means we use the CAs from the ca-certificates package
57+ ENV SSL_CERT_FILE /etc/ssl/certs/ca-certificates.crt
3358
3459# By default, run the operator using kopf
3560USER $APP_UID
0 commit comments