From 22e76c1c7fe2268062b6db1ea11529ef45fbd818 Mon Sep 17 00:00:00 2001 From: Dean Roehrich Date: Wed, 15 Jan 2025 10:20:45 -0600 Subject: [PATCH 1/2] Make it easier to build on a Mac The wget in openmpi-builder has trouble with certs when fetching the openmpi source. Disable the cert check and replace it with a checksum check. Signed-off-by: Dean Roehrich --- .github/workflows/main.yml | 19 +++++++++++++++++++ Dockerfile | 22 ++++++++++++++++------ Makefile | 4 ++-- Readme.md | 2 +- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bbc13bc..6e4009c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -4,14 +4,20 @@ on: [push] jobs: production: + # Testing with nektos/act: + # $ act --rm -j production --container-architecture linux/amd64 --pull=false --bind --action-offline-mode push + # runs-on: ubuntu-latest steps: - name: "Build context" run: | + echo "env.ACT is ${{ env.ACT }}" echo "ref is ${{ github.ref }}" echo "ref_type is ${{ github.ref_type }}" + echo "head.sha is ${{ github.event.pull_request.head.sha }}" - name: "Checkout repository" + if: ${{ !env.ACT }} # skip during local actions testing id: checkout_repo uses: actions/checkout@v3 with: @@ -33,6 +39,7 @@ jobs: shell: bash - name: "Docker metadata" + if: ${{ !env.ACT }} # skip during local actions testing id: meta uses: docker/metadata-action@v4 with: @@ -54,6 +61,7 @@ jobs: type=semver,pattern={{major}}.{{minor}} - name: "Docker login" + if: ${{ !env.ACT }} # skip during local actions testing id: docker_login uses: docker/login-action@v2 with: @@ -62,12 +70,23 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: "Build the final Docker image" + if: ${{ !env.ACT }} # skip during local actions testing id: docker_build uses: docker/build-push-action@v3 with: push: true target: production tags: ${{ steps.meta.outputs.tags }} + + - name: "Build the final Docker image in nektos/act" + # The docker/build-push-action does actions/checkout, and that can't be + # turned off. So instead, we run the docker build command directly here + # assuming that 'act' was run with the '--bind' arg. + if: ${{ env.ACT }} # only during local actions testing + id: docker_build_nektos_act + run: /usr/bin/docker buildx build --tag ghcr.io/${{ env.REPO_NAME }}:act --target production . + + debug: runs-on: ubuntu-latest steps: diff --git a/Dockerfile b/Dockerfile index 57a77c3..bf60d94 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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, @@ -18,24 +18,31 @@ # 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 +# See https://www.open-mpi.org/software/ompi/v4.1/ for releases and their +# checkums. ARG OPENMPI_VERSION=4.1.7 +ARG OPENMPI_MD5=787d2bc8b3db336db97c34236934b3df FROM mpioperator/openmpi-builder:v$MPI_OPERATOR_VERSION AS builder ARG OPENMPI_VERSION +ARG OPENMPI_MD5 ENV OPENMPI_VERSION=$OPENMPI_VERSION +ENV OPENMPI_MD5=$OPENMPI_MD5 RUN apt-get update && apt-get install -y \ ca-certificates \ wget tar make gcc cmake perl libbz2-dev pkg-config openssl libssl-dev libcap-dev \ git libattr1-dev \ openssh-server openssh-client \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ + && update-ca-certificates # 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 --no-check-certificate https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-$OPENMPI_VERSION.tar.gz +RUN [ $(md5sum openmpi-$OPENMPI_VERSION.tar.gz | awk '{print $1}') = "$OPENMPI_MD5" ] +RUN gunzip -c openmpi-$OPENMPI_VERSION.tar.gz | tar xf - \ && cd openmpi-$OPENMPI_VERSION \ && ./configure --prefix=/opt/openmpi-$OPENMPI_VERSION \ && make all install @@ -86,7 +93,9 @@ RUN git clone --depth 1 https://github.com/nearnodeflash/mpifileutils.git --bran FROM builder AS builder-debug ARG OPENMPI_VERSION +ARG OPENMPI_MD5 ENV OPENMPI_VERSION=$OPENMPI_VERSION +ENV OPENMPI_MD5=$OPENMPI_MD5 WORKDIR /deps RUN cd build \ @@ -99,8 +108,9 @@ 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 [ $(md5sum openmpi-$OPENMPI_VERSION.tar.gz | awk '{print $1}') = "$OPENMPI_MD5" ] +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 diff --git a/Makefile b/Makefile index e786eef..bde8913 100644 --- a/Makefile +++ b/Makefile @@ -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, @@ -21,7 +21,7 @@ IMAGE_TAG_BASE ?= ghcr.io/nearnodeflash/nnf-mfu docker-build: VERSION ?= $(shell cat .version) docker-build: TARGET ?= production docker-build: .version - docker build --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) . + docker build --progress plain --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) . docker-build-debug: VERSION ?= $(shell cat .version) docker-build-debug: IMAGE_TAG_BASE := $(IMAGE_TAG_BASE)-debug diff --git a/Readme.md b/Readme.md index b668c74..1adf539 100644 --- a/Readme.md +++ b/Readme.md @@ -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. From 945ec83eee9dffc5286e4c82443a8db006d81f0a Mon Sep 17 00:00:00 2001 From: Dean Roehrich Date: Thu, 16 Jan 2025 13:19:12 -0600 Subject: [PATCH 2/2] revert Makefile to master Signed-off-by: Dean Roehrich --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index bde8913..e786eef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# Copyright 2021-2025 Hewlett Packard Enterprise Development LP +# Copyright 2021-2024 Hewlett Packard Enterprise Development LP # Other additional copyright holders may be indicated within. # # The entirety of this work is licensed under the Apache License, @@ -21,7 +21,7 @@ IMAGE_TAG_BASE ?= ghcr.io/nearnodeflash/nnf-mfu docker-build: VERSION ?= $(shell cat .version) docker-build: TARGET ?= production docker-build: .version - docker build --progress plain --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) . + docker build --target $(TARGET) -t $(IMAGE_TAG_BASE):$(VERSION) . docker-build-debug: VERSION ?= $(shell cat .version) docker-build-debug: IMAGE_TAG_BASE := $(IMAGE_TAG_BASE)-debug