diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8e0d79af63341e39586dae04148cb9731d78afc2..6c79ec74ff6a07d6651f110069a4ade1bbd55b23 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -224,7 +224,6 @@ oneapi_jug_dev:default: - docker build -t ${CI_REGISTRY_IMAGE}/${BUILD_IMAGE}:${INTERNAL_TAG} -f containers/oneapi/onedev.Dockerfile containers/oneapi - --no-cache - !reference [.build, script] diff --git a/containers/oneapi/onedev.Dockerfile b/containers/oneapi/onedev.Dockerfile index a9241526da8961e1f2f5349573a5479f89c0c80b..a775ae8af6caf8190ce97fecac8bd7316075459e 100644 --- a/containers/oneapi/onedev.Dockerfile +++ b/containers/oneapi/onedev.Dockerfile @@ -2,89 +2,28 @@ # Container based on Jug_dev with Intel oneAPI support. +# Start with Debian base and layer oneAPI on top, prevents spack compiler errors. + ## ======================================================================================== -## STAGE 1: Set up Intel OneAPI Toolkit -## Use Intel's HPC-kit +## STAGE 1: spack builder image +## EIC builder image with spack ## ======================================================================================== +ARG DOCKER_REGISTRY="eicweb.phy.anl.gov:4567/containers/eic_container/" +ARG INTERNAL_TAG="testing" -FROM intel/oneapi-hpckit:2022.1.2-devel-ubuntu18.04 AS oneapi - - -COPY bashrc /root/.bashrc - -ENV CLICOLOR_FORCE=1 \ - LANGUAGE=en_US.UTF-8 \ - LANG=en_US.UTF-8 \ - LC_ALL=en_US.UTF-8 +FROM ${DOCKER_REGISTRY}debian_base:${INTERNAL_TAG} as builder -## Install additional packages. Remove the auto-cleanup functionality -## for docker, as we're using the new buildkit cache instead. -## We also install gitlab-runner, from the buster package (as bullseye is not available atm) -## TODO: libyaml-cpp-dev is a dependency for afterburner. We can probably remove -## this once afterburner is added to spack +## Install some extra spack dependencies RUN --mount=type=cache,target=/var/cache/apt \ rm -f /etc/apt/apt.conf.d/docker-clean \ - && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \ - && echo "US/Eastern" > /etc/timezone \ && apt-get -yqq update \ - && apt-get -yqq upgrade \ && apt-get -yqq install --no-install-recommends \ - bc \ - ca-certificates \ - clang-format \ - clang-tidy \ - curl \ - file \ - build-essential \ - gdb \ - gfortran \ - ghostscript \ - git \ - gnupg2 \ - gv \ - iproute2 \ - iputils-ping \ - iputils-tracepath \ - less \ - libcbor-xs-perl \ - libjson-xs-perl \ - libyaml-cpp-dev \ - locales \ - lua-posix \ - make \ - nano \ - openssh-client \ - parallel \ - poppler-utils \ python3 \ python3-dev \ python3-distutils \ - time \ - unzip \ - valgrind \ - vim-nox \ - wget \ - && localedef -i en_US -f UTF-8 en_US.UTF-8 \ - && gcc --version \ - && curl -L \ - "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" \ - | bash \ - && sed -i "s/bookworm/buster/" \ - /etc/apt/sources.list.d/runner_gitlab-runner.list \ - && apt-get -yqq update \ - && apt-get -yqq install --no-install-recommends \ - gitlab-runner \ - && apt-get -yqq autoremove \ - && rm -rf /var/lib/apt/lists/* - - -## ======================================================================================== -## STAGE 2: spack builder image -## EIC builder image with spack -## ======================================================================================== - -FROM oneapi AS builder + python-is-python3 \ + && rm -rf /var/lib/apt/lists/* ## Setup spack @@ -236,7 +175,7 @@ USER 0 WORKDIR / ## ======================================================================================== -## STAGE 3: staging image with unnecessariy packages removed and stripped binaries +## STAGE 2: staging image with unnecessariy packages removed and stripped binaries ## ======================================================================================== FROM builder AS staging @@ -286,25 +225,94 @@ ADD https://dl.min.io/client/mc/release/linux-amd64/mc /usr/local/bin RUN chmod a+x /usr/local/bin/mc ## ======================================================================================== -## STAGE 4 -## Lean target image +## STAGE 3: Set up Intel OneAPI Toolkit +## Use Intel's HPC-kit and Create Lean image from staging ## ======================================================================================== -FROM staging AS lean +FROM intel/oneapi-hpckit:2022.1.2-devel-ubuntu18.04 AS oneapi -# We cannot use a new base image and copy from staging -# So, remove spack and clean-up existing image -RUN rm -rf $SPACK_ROOT \ - && rm -rf /var/cache/spack-mirror \ - && export PATH=$OLD_PATH \ - && unset OLD_PATH \ - && rm -rf /usr/local \ + +COPY bashrc /root/.bashrc + +ENV CLICOLOR_FORCE=1 \ + LANGUAGE=en_US.UTF-8 \ + LANG=en_US.UTF-8 \ + LC_ALL=en_US.UTF-8 + +## Install additional packages. Remove the auto-cleanup functionality +## for docker, as we're using the new buildkit cache instead. +## We also install gitlab-runner, from the buster package (as bullseye is not available atm) +## TODO: libyaml-cpp-dev is a dependency for afterburner. We can probably remove +## this once afterburner is added to spack +RUN --mount=type=cache,target=/var/cache/apt \ + rm -f /etc/apt/apt.conf.d/docker-clean \ + && ln -fs /usr/share/zoneinfo/America/New_York /etc/localtime \ + && echo "US/Eastern" > /etc/timezone \ + && apt-get -yqq update \ + && apt-get -yqq upgrade \ + && apt-get -yqq install --no-install-recommends \ + bc \ + ca-certificates \ + clang-format \ + clang-tidy \ + curl \ + file \ + build-essential \ + gdb \ + ghostscript \ + git \ + gnupg2 \ + gv \ + iproute2 \ + iputils-ping \ + iputils-tracepath \ + less \ + libcbor-xs-perl \ + libjson-xs-perl \ + libyaml-cpp-dev \ + locales \ + lua-posix \ + make \ + nano \ + openssh-client \ + parallel \ + poppler-utils \ + python3 \ + python3-dev \ + python3-distutils \ + time \ + unzip \ + valgrind \ + vim-nox \ + wget \ + && localedef -i en_US -f UTF-8 en_US.UTF-8 \ + && gcc --version \ + && curl -L \ + "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" \ + | bash \ + && sed -i "s/bookworm/buster/" \ + /etc/apt/sources.list.d/runner_gitlab-runner.list \ + && apt-get -yqq update \ + && apt-get -yqq install --no-install-recommends \ + gitlab-runner \ + && apt-get -yqq autoremove \ + && rm -rf /var/lib/apt/lists/* + +## copy over everything we need from staging in a single layer +RUN --mount=from=staging,target=/staging \ + rm -rf /usr/local \ + && cp -r /staging/opt/spack-environment /opt/spack-environment \ + && cp -r /staging/opt/software /opt/software \ + && cp -r /staging/usr/._local /usr/._local \ && cd /usr/._local \ && PREFIX_PATH=$(realpath $(ls | tail -n1)) \ && echo "Found spack true prefix path to be $PREFIX_PATH" \ && cd - \ - && ln -s ${PREFIX_PATH} /usr/local - + && ln -s ${PREFIX_PATH} /usr/local \ + && cp /staging/etc/profile.d/*.sh /etc/profile.d/ \ + && cp /staging/etc/eic-env.sh /etc/eic-env.sh \ + && cp /staging/etc/jug_info /etc/jug_info \ + && cp -r /staging/.singularity.d /.singularity.d ## set the jug_dev version and add the afterburner ## TODO: move afterburner to spack when possible @@ -319,4 +327,3 @@ CMD ["bash", "--rcfile", "/etc/profile", "-l"] USER 0 WORKDIR / SHELL ["/usr/local/bin/eic-shell"] - diff --git a/spack.yaml b/spack.yaml index 48650471bd914385839b1e04dd921b5c48f9845f..f87e73c8b452d0348a2cc2e0926c1b60c986fe73 100644 --- a/spack.yaml +++ b/spack.yaml @@ -44,17 +44,3 @@ spack: all: compiler: [gcc] view: /usr/local - compilers:: - - compiler: - spec: gcc@11.2.0 - paths: - cc: /usr/bin/gcc - cxx: /usr/bin/g++ - f77: /usr/bin/gfortran - fc: /usr/bin/gfortran - flags: {} - operating_system: ubuntu18.04 - target: x86_64 - modules: [] - environment: {} - extra_rpaths: []