Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(backport): Use uv during Dockerfile build #2503

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
ARG BASE_IMAGE=python:3.11-slim-bullseye
ARG BASE_IMAGE=python:3.12-slim-bullseye
# hadolint ignore=DL3006
FROM ${BASE_IMAGE} as base

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 && \
apt-get -y autoclean && \
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

Expand Down Expand Up @@ -59,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"]