Skip to content

Commit

Permalink
Use pip constraints file in ngen Dockerfile.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
robertbartel committed Jul 18, 2024
1 parent d302fc3 commit 74f7759
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docker/main/ngen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down
5 changes: 5 additions & 0 deletions docker/main/ngen/constraints.txt
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 74f7759

Please sign in to comment.