Skip to content

Instantly share code, notes, and snippets.

@panda1100
Created June 8, 2023 05:31
Show Gist options
  • Save panda1100/c43c08dcf6f894d8c3f03f8b86da8638 to your computer and use it in GitHub Desktop.
Save panda1100/c43c08dcf6f894d8c3f03f8b86da8638 to your computer and use it in GitHub Desktop.
2-stage build example
Bootstrap: docker
From: rockylinux/rockylinux:latest
Stage: build
%post
dnf -y group install "Development tools"
dnf -y install epel-release
dnf -y install 'dnf-command(config-manager)'
dnf -y config-manager --set-enabled powertools
dnf -y install wget
dnf -y install hwloc slurm-pmi slurm-pmi-devel
dnf -y clean all
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz
tar zxvf openmpi-4.1.4.tar.gz && rm openmpi-4.1.4.tar.gz
cd openmpi-4.1.4
./configure --with-hwloc=internal --prefix=/opt/openmpi/4.1.4 --with-slurm --with-pmi=/usr
make -j
make install
Bootstrap: docker
From: rockylinux/rockylinux:latest
Stage: runtime
%files from build
/opt/openmpi/4.1.4 /opt/openmpi/4.1.4
%files
openfoam-files.rc/* /openfoam/
%post
dnf -y install wget rsync \
passwd shadow-utils nss_wrapper
dnf -y install 'dnf-command(config-manager)'
dnf -y config-manager --set-enabled powertools
dnf -y install epel-release
dnf -y install 'dnf-command(copr)'
dnf -y copr enable openfoam/openfoam
dnf -y install openfoam2206
dnf -y clean all
%post
/bin/sh /openfoam/assets/post-install.sh -fix-perms -no-sudo
%post
dnf -y install slurm-pmi
dnf -y clean all
echo 'export MPI_ARCH_PATH=/opt/openmpi/4.1.4' > $(bash /openfoam/assets/query.sh -show-prefix)/etc/config.sh/prefs.sys-openmpi
%runscript
exec /openfoam/run "$@"
%labels
Author Yoshiaki Senda
Author OpenCFD Ltd.
# Copyright for Original definition file
# ---------------------------------*-sh-*------------------------------------
# Copyright (C) 2021-2022 OpenCFD Ltd.
# SPDX-License-Identifier: (GPL-3.0+)
#
# Create openfoam '-run' image for Rocky Linux using copr repo.
#
# Example
# apptainer build --fakeroot openfoam2212.sif openfoam-run_rocky.def
#
# ---------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment