# # This file was created by generate_dockerfiles.py. # Usage: ./spack_cache_start.sh; podman build --shm-size=1g -t spack_ssmp-static -f ./Dockerfile.test_spack_ssmp-static ../../ # ARG BASE_IMAGE="ubuntu:26.04" ###### Stage 1: Build CP2K dependencies ###### FROM "${BASE_IMAGE}" AS build_deps RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ bzip2 \ ca-certificates \ cmake \ g++ gcc gfortran \ git \ gnupg \ libssh-dev \ libssl-dev \ libtool \ libtool-bin \ lsb-release \ make \ patch \ pkgconf \ python3 \ python3-dev \ python3-pip \ python3-venv \ unzip \ wget \ xxd \ xz-utils \ zlib1g \ zlib1g-dev \ zstd \ && rm -rf /var/lib/apt/lists/* ARG IMAGE_TAG ENV IMAGE_TAG=${IMAGE_TAG:-spack_ssmp-static} ARG SPACK_CACHE ENV SPACK_CACHE="${SPACK_CACHE:-s3://spack-cache --s3-endpoint-url=http://host.containers.internal:9000}" # Build CP2K dependencies WORKDIR /opt/cp2k COPY ./tools/spack ./tools/spack COPY ./tools/docker ./tools/docker COPY ./make_cp2k.sh . RUN ./make_cp2k.sh -bd_only -cv ssmp-static -gpu none -mpi no ###### Stage 2: Build CP2K ###### FROM build_deps AS build_cp2k COPY ./src ./src COPY ./data ./data COPY ./tools/build_utils ./tools/build_utils COPY ./cmake ./cmake COPY ./CMakeLists.txt . RUN ./make_cp2k.sh -cv ssmp-static -gpu none -mpi no ###### Stage 3: Install CP2K ###### FROM "${BASE_IMAGE}" AS install_cp2k RUN apt-get update -qq && apt-get install -qq --no-install-recommends \ g++ gcc gfortran \ python3 \ && rm -rf /var/lib/apt/lists/* WORKDIR /opt/cp2k # Install CP2K dependencies built with spack COPY --from=build_cp2k /opt/cp2k/spack/spack/opt/spack ./spack/spack/opt/spack # Install CP2K COPY --from=build_cp2k /opt/cp2k/install ./install # Install CP2K regression tests COPY ./tests ./tests COPY --from=build_cp2k /opt/cp2k/src/grid/sample_tasks ./src/grid/sample_tasks # Install CP2K/Quickstep CI benchmarks COPY ./benchmarks/CI ./benchmarks/CI # Do not rely only on LD_LIBRARY_PATH because it is fragile COPY --from=build_cp2k /etc/ld.so.conf.d/cp2k.conf /etc/ld.so.conf.d/cp2k.conf RUN ldconfig # Run CP2K regression test RUN /opt/cp2k/install/bin/launch /opt/cp2k/install/bin/run_tests --keepalive || echo "ERROR: Tests failed" # Create entrypoint and finalise container build WORKDIR /mnt ENTRYPOINT ["/opt/cp2k/install/bin/launch"] CMD ["cp2k", "--help", "--version"]