From 64f9fb659fb27075a56c5315d942e501a9281c82 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Sat, 25 May 2024 16:18:27 -0500 Subject: [PATCH 1/2] Backport PR #2485: chore: Use uv during Dockerfile build --- docker/Dockerfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 50c2f31e95..b23f9cdcbb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -6,7 +6,7 @@ FROM base as builder # Set PATH to pickup virtual environment by default ENV PATH=/usr/local/venv/bin:"${PATH}" COPY . /code -# hadolint ignore=DL3003,SC2102 +# hadolint ignore=DL3003,SC2102,SC1091 RUN apt-get -qq -y update && \ apt-get -qq -y install --no-install-recommends \ git && \ @@ -14,10 +14,12 @@ RUN apt-get -qq -y update && \ apt-get -y autoremove && \ rm -rf /var/lib/apt/lists/* && \ python -m venv /usr/local/venv && \ + . /usr/local/venv/bin/activate && \ cd /code && \ - python -m pip --no-cache-dir install --upgrade pip setuptools wheel && \ - python -m pip --no-cache-dir install '.[xmlio,contrib]' && \ - python -m pip list + python -m pip --no-cache-dir install --upgrade uv && \ + uv pip install --no-cache --upgrade pip setuptools wheel && \ + uv pip install --no-cache '.[xmlio,contrib]' && \ + uv pip list FROM base From 060d0958fb94eb1bc88d07e7d983a51a19ee094f Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Thu, 30 May 2024 13:44:07 -0500 Subject: [PATCH 2/2] backport rest of Dockerfile --- docker/Dockerfile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index b23f9cdcbb..47ff491ea6 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -ARG BASE_IMAGE=python:3.11-slim-bullseye +ARG BASE_IMAGE=python:3.12-slim-bullseye # hadolint ignore=DL3006 FROM ${BASE_IMAGE} as base @@ -61,4 +61,8 @@ ENV LANG=C.UTF-8 ENV PATH=${HOME}/.local/bin:${PATH} +# The first ever run of the CLI API incurs some overhead so do that during the +# build instead of making the user wait +RUN pyhf --version + ENTRYPOINT ["/usr/local/venv/bin/pyhf"]