cp2k/tools/docker/Dockerfile.test_spack_psmp-rockylinux

92 lines
2.3 KiB
Text

#
# This file was created by generate_dockerfiles.py.
# Usage: ./spack_cache_start.sh; podman build --shm-size=1g -t spack_psmp-rockylinux -f ./Dockerfile.test_spack_psmp-rockylinux ../../
#
ARG BASE_IMAGE="docker.io/rockylinux/rockylinux:10"
###### Stage 1: Build CP2K dependencies ######
FROM "${BASE_IMAGE}" AS build_deps
RUN dnf -y install dnf-plugins-core && \
dnf --enablerepo=crb -qy install \
bzip2 \
cmake \
gcc gcc-c++ gcc-fortran \
git \
libtool \
openssl-devel \
patch \
python3 \
python3-devel \
python3-pip \
unzip \
wget \
xz \
zlib-devel \
zlib-static \
&& dnf clean -q all
ARG IMAGE_TAG
ENV IMAGE_TAG=${IMAGE_TAG:-spack_psmp-rockylinux}
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 psmp -gpu none -gv 14 -mpi mpich -ue
###### 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 psmp -gv 14 -gpu none -mpi mpich
###### Stage 3: Install CP2K ######
FROM "${BASE_IMAGE}" AS install_cp2k
RUN dnf -y install dnf-plugins-core && \
dnf --enablerepo=crb -qy install \
gcc gcc-c++ gcc-fortran \
python3 \
python3-pip \
&& dnf clean -q all
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"]