| 1 |
# SPDX-FileCopyrightText: 2026 Oak Ridge National Laboratory and Contributors |
| 2 |
# |
| 3 |
# SPDX-License-Identifier: Apache-2.0 |
| 4 |
|
| 5 |
# vim: ft=dockerfile |
| 6 |
ARG BASE_IMAGE=docker.io/ecpe4s/ubuntu22.04-runner-amd64-gcc-11.4:2025.03.01 |
| 7 |
FROM $BASE_IMAGE |
| 8 |
|
| 9 |
ARG SPACK_VERSION=v1.0.2 |
| 10 |
ARG SPACK_MIRROR="https://binaries.spack.io/v2025.07.0" |
| 11 |
ARG ENABLED_ENVS="serial,ompi,mpich" |
| 12 |
ARG EXTERNAL_PACKAGES |
| 13 |
ARG EXTRA_VARIANTS |
| 14 |
ARG EXTRA_SPECS |
| 15 |
ARG PATCH_VARIANT_XROOTD |
| 16 |
|
| 17 |
|
| 18 |
# Clone and patch spack |
| 19 |
WORKDIR / |
| 20 |
RUN if ! [ -d /spack ]; then \ |
| 21 |
git clone --depth 1 --single-branch --branch ${SPACK_VERSION} https://github.com/spack/spack; \ |
| 22 |
else \ |
| 23 |
git fetch --all && git checkout -t origin/${SPACK_VERSION}; \ |
| 24 |
fi |
| 25 |
|
| 26 |
COPY 0002-adios2-add-xrootd-variant.patch /spack |
| 27 |
|
| 28 |
COPY packages.yaml /etc/spack/packages.yaml |
| 29 |
|
| 30 |
WORKDIR /spack |
| 31 |
|
| 32 |
# Install base specs |
| 33 |
RUN . /spack/share/spack/setup-env.sh && \ |
| 34 |
spack repo update --branch "releases/v2025.07" builtin && \ |
| 35 |
if test -n "${EXTERNAL_PACKAGES}"; then spack external find ${EXTERNAL_PACKAGES}; fi && \ |
| 36 |
if test -n "${PATCH_VARIANT_XROOTD}"; then cd ~/.spack/package_repos/fncqgg4 && git apply /spack/0002-adios2-add-xrootd-variant.patch && cd /spack; fi && \ |
| 37 |
spack mirror add binaries "${SPACK_MIRROR}" && \ |
| 38 |
export ADIOS_SPEC_NO_MPI="adios2~mpi${EXTRA_VARIANTS}" && \ |
| 39 |
export ADIOS_SPEC_OPENMPI="adios2+mpi${EXTRA_VARIANTS} ^openmpi" && \ |
| 40 |
export ADIOS_SPEC_MPICH="adios2+mpi${EXTRA_VARIANTS} ^mpich" && \ |
| 41 |
spack config add "config:checksum:false" && \ |
| 42 |
spack config add "config:build_jobs:$(nproc)" && \ |
| 43 |
spack config add "concretizer:unify:true" && \ |
| 44 |
if echo "$ENABLED_ENVS" | grep -q serial; then \ |
| 45 |
spack env create adios2-ci-serial && \ |
| 46 |
spack -e adios2-ci-serial add ${ADIOS_SPEC_NO_MPI} ${EXTRA_SPECS} && \ |
| 47 |
spack -e adios2-ci-serial concretize && \ |
| 48 |
spack -e adios2-ci-serial install \ |
| 49 |
--include-build-deps \ |
| 50 |
--no-check-signature \ |
| 51 |
--fail-fast \ |
| 52 |
--only dependencies ${ADIOS_SPEC_NO_MPI} && \ |
| 53 |
{ [ -n "${EXTRA_SPECS}" ] && spack -e adios2-ci-serial install \ |
| 54 |
--no-check-signature \ |
| 55 |
--fail-fast \ |
| 56 |
${EXTRA_SPECS}; }; \ |
| 57 |
fi && \ |
| 58 |
if echo "$ENABLED_ENVS" | grep -q ompi ; then \ |
| 59 |
spack env create adios2-ci-ompi && \ |
| 60 |
spack -e adios2-ci-ompi add ${ADIOS_SPEC_OPENMPI} ${EXTRA_SPECS} && \ |
| 61 |
spack -e adios2-ci-ompi concretize && \ |
| 62 |
spack -e adios2-ci-ompi install \ |
| 63 |
--include-build-deps \ |
| 64 |
--no-check-signature \ |
| 65 |
--fail-fast \ |
| 66 |
--only dependencies && \ |
| 67 |
{ [ -n "${EXTRA_SPECS}" ] && spack -e adios2-ci-ompi install \ |
| 68 |
--no-check-signature \ |
| 69 |
--fail-fast \ |
| 70 |
${EXTRA_SPECS}; }; \ |
| 71 |
fi && \ |
| 72 |
if echo "$ENABLED_ENVS" | grep -q mpich; then \ |
| 73 |
spack env create adios2-ci-mpich && \ |
| 74 |
spack -e adios2-ci-mpich add ${ADIOS_SPEC_MPICH} ${EXTRA_SPECS} && \ |
| 75 |
spack -e adios2-ci-mpich concretize && \ |
| 76 |
spack -e adios2-ci-mpich install \ |
| 77 |
--include-build-deps \ |
| 78 |
--no-check-signature \ |
| 79 |
--fail-fast \ |
| 80 |
--only dependencies && \ |
| 81 |
{ [ -n "${EXTRA_SPECS}" ] && spack -e adios2-ci-mpich install \ |
| 82 |
--no-check-signature \ |
| 83 |
--fail-fast \ |
| 84 |
${EXTRA_SPECS}; }; \ |
| 85 |
fi && \ |
| 86 |
spack clean -a && \ |
| 87 |
echo "source /spack/share/spack/setup-env.sh" >> /etc/profile.d/zz-spack.sh |
| 88 |
|
| 89 |
### Other missing packages (compared to el8 base): |
| 90 |
RUN apt-get update && apt-get install -y \ |
| 91 |
ccache \ |
| 92 |
libcurl4-gnutls-dev && \ |
| 93 |
apt-get autoremove --purge -y && \ |
| 94 |
apt-get clean && \ |
| 95 |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 && \ |
| 96 |
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 100 && \ |
| 97 |
update-alternatives --install /usr/bin/gfortran gfortran /usr/bin/gfortran-11 100 |
| 98 |
|
| 99 |
ENV PATH=/opt/cmake/bin:${PATH} |
| 100 |
|
| 101 |
ENTRYPOINT ["/bin/bash", "--login"] |