From b8dcc03bed53e677d50d68e81673dee120cf33a0 Mon Sep 17 00:00:00 2001 From: Robert Bartel Date: Thu, 18 Jul 2024 10:21:12 -0400 Subject: [PATCH] Use pip constraints file in ngen Dockerfile. Adding constraints file to ngen (and related) image build to control numpy and pip versions as needed for compatibility, using this instead of doing directly within the Dockerfile itself in pip commands. --- docker/main/ngen/Dockerfile | 6 +++++- docker/main/ngen/constraints.txt | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 docker/main/ngen/constraints.txt diff --git a/docker/main/ngen/Dockerfile b/docker/main/ngen/Dockerfile index bd7a59457..f126661a9 100644 --- a/docker/main/ngen/Dockerfile +++ b/docker/main/ngen/Dockerfile @@ -290,12 +290,16 @@ FROM rocky-base as rocky-ngen-packaged-deps ARG ROCKY_NGEN_DEPS_REQUIRED +# Set up pip constraints file for this and descendent stages +COPY constraints.txt ${WORKDIR}/constraints.txt +ENV PIP_CONSTRAINT=${WORKDIR}/constraints.txt + # TODO: later, go back and change all pip3/python3 to just pip/python (but leave for now to limit scope) # Note that this includes numpy, which is needed for Python BMI support, regardless of BMI module USER root RUN dnf update -y && dnf install -y ${ROCKY_NGEN_DEPS_REQUIRED} && dnf clean -y all \ && ln -s $(which python3) $(which python3 | sed 's/python3/python/') \ - && pip install --no-cache-dir "pip>=23.0,<23.1" wheel packaging \ + && pip install --no-cache-dir pip wheel packaging \ && if [ "${NGEN_WITH_PYTHON}" == "ON" ]; then pip install --no-cache-dir numpy; fi USER ${USER} diff --git a/docker/main/ngen/constraints.txt b/docker/main/ngen/constraints.txt new file mode 100644 index 000000000..6a53b3f2b --- /dev/null +++ b/docker/main/ngen/constraints.txt @@ -0,0 +1,5 @@ +### Constrain pip +pip>=23.0,<23.1 + +### Constrain numpy to < 2.0.0 due to current ngen compatibility issue +numpy~=1.0 \ No newline at end of file