Skip to content

Commit

Permalink
Make it easier to build on a Mac
Browse files Browse the repository at this point in the history
The wget in openmpi-builder has trouble with certs when fetching the openmpi
source. Let's move that source-fetching out of the Dockerfile.

Signed-off-by: Dean Roehrich <[email protected]>
  • Loading branch information
roehrich-hpe committed Jan 15, 2025
1 parent bb6a6a9 commit 6465da0
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Get openmpi source"
run: make get_openmpi

- name: "Build the final Docker image"
id: docker_build
uses: docker/build-push-action@v3
Expand Down Expand Up @@ -126,6 +129,9 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: "Get openmpi source"
run: make get_openmpi

- name: "Build the debug Docker image"
id: docker_build
uses: docker/build-push-action@v3
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.version
openmpi-*.tar.gz

16 changes: 10 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2024 Hewlett Packard Enterprise Development LP
# Copyright 2021-2025 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is licensed under the Apache License,
Expand All @@ -18,7 +18,7 @@
# These ARGs must be before the first FROM. This allows them to be valid for
# use in FROM instructions.
ARG MPI_OPERATOR_VERSION=0.6.0
ARG OPENMPI_VERSION=4.1.7
ARG OPENMPI_VERSION

FROM mpioperator/openmpi-builder:v$MPI_OPERATOR_VERSION AS builder

Expand All @@ -32,10 +32,12 @@ RUN apt-get update && apt-get install -y \
openssh-server openssh-client \
&& rm -rf /var/lib/apt/lists/*

COPY openmpi-$OPENMPI_VERSION.tar.gz openmpi-$OPENMPI_VERSION.tar.gz

# Remove the OS binary of openmpi and build from source
RUN apt-get remove -y openmpi-bin
RUN wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OPENMPI_VERSION.tar.gz \
&& gunzip -c openmpi-$OPENMPI_VERSION.tar.gz | tar xf - \
#RUN wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OPENMPI_VERSION.tar.gz
RUN gunzip -c openmpi-$OPENMPI_VERSION.tar.gz | tar xf - \
&& cd openmpi-$OPENMPI_VERSION \
&& ./configure --prefix=/opt/openmpi-$OPENMPI_VERSION \
&& make all install
Expand Down Expand Up @@ -88,6 +90,8 @@ FROM builder AS builder-debug
ARG OPENMPI_VERSION
ENV OPENMPI_VERSION=$OPENMPI_VERSION

COPY openmpi-$OPENMPI_VERSION.tar.gz openmpi-$OPENMPI_VERSION.tar.gz

WORKDIR /deps
RUN cd build \
&& cmake ../mpifileutils \
Expand All @@ -99,8 +103,8 @@ RUN cd build \
&& make install


RUN wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OPENMPI_VERSION.tar.gz \
&& gunzip -c openmpi-$OPENMPI_VERSION.tar.gz | tar xf - \
#RUN wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OPENMPI_VERSION.tar.gz
RUN gunzip -c openmpi-$OPENMPI_VERSION.tar.gz | tar xf - \
&& cd openmpi-$OPENMPI_VERSION \
&& ./configure --prefix=/opt/openmpi-$OPENMPI_VERSION-debug --enable-debug \
&& make all install
Expand Down
22 changes: 17 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021-2024 Hewlett Packard Enterprise Development LP
# Copyright 2021-2025 Hewlett Packard Enterprise Development LP
# Other additional copyright holders may be indicated within.
#
# The entirety of this work is licensed under the Apache License,
Expand All @@ -18,15 +18,27 @@
# NOTE: git-version-gen will generate a value for VERSION, unless you override it.
IMAGE_TAG_BASE ?= ghcr.io/nearnodeflash/nnf-mfu

OPENMPI_VERSION ?= 4.1.7

all: docker-build

openmpi-$(OPENMPI_VERSION).tar.gz: Makefile Dockerfile
if [[ ! -f openmpi-$(OPENMPI_VERSION).tar.gz ]]; then \
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$(OPENMPI_VERSION).tar.gz; \
fi

.PHONY: get-openmpi
get-openmpi: openmpi-$(OPENMPI_VERSION).tar.gz

docker-build: VERSION ?= $(shell cat .version)
docker-build: TARGET ?= production
docker-build: .version
docker build --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) .
docker-build: .version openmpi-$(OPENMPI_VERSION).tar.gz
docker build --build-arg="OPENMPI_VERSION=$(OPENMPI_VERSION)" --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) .

docker-build-debug: VERSION ?= $(shell cat .version)
docker-build-debug: IMAGE_TAG_BASE := $(IMAGE_TAG_BASE)-debug
docker-build-debug: .version
docker build --target debug -t $(IMAGE_TAG_BASE):$(VERSION) .
docker-build-debug: .version openmpi-$(OPENMPI_VERSION).tar.gz
docker build --build-arg="OPENMPI_VERSION=$(OPENMPI_VERSION)" --target debug -t $(IMAGE_TAG_BASE):$(VERSION) .

docker-push: VERSION ?= $(shell cat .version)
docker-push: .version
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Utils](https://github.com/hpc/mpifileutils) commands.

The foundation of this image relies on
[mpi-operator](https://github.com/kubeflow/mpi-operator) with the addition of
MPI File Utils that have been constructed from source. At the time of this writing, the mpi-operator image installs v4.1.0 of Open MPI.
MPI File Utils that have been constructed from source.

This image is primarily used for NNF Data Movement and as a base image for running NNF User Containers.

Expand Down

0 comments on commit 6465da0

Please sign in to comment.