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

Make it easier to build on a Mac #30

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
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
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
22 changes: 16 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,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
Expand Down Expand Up @@ -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 \
Expand All @@ -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
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
Loading