cp2k/tools/docker/Dockerfile.test_spack_pdbg-rawhide

91 lines
2.2 KiB
Text

#
# This file was created by generate_dockerfiles.py.
# Usage: ./spack_cache_start.sh; podman build --shm-size=1g -t spack_pdbg-rawhide -f ./Dockerfile.test_spack_pdbg-rawhide ../../
#
ARG BASE_IMAGE="fedora:rawhide"
###### Stage 1: Build CP2K dependencies ######
FROM "${BASE_IMAGE}" AS build_deps
RUN dnf -qy install \
cmake \
g++ gcc gfortran \
git \
libffi-devel \
liblsan \
libtool \
make \
patch \
perl-core \
pkg-config \
python3 \
python3-devel \
unzip \
wget \
zlib-devel \
zlib-static \
&& dnf clean -q all
ARG IMAGE_TAG
ENV IMAGE_TAG=${IMAGE_TAG:-spack_pdbg-rawhide}
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 pdbg -gpu none -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 pdbg -gpu none -mpi mpich
###### Stage 3: Install CP2K ######
FROM "${BASE_IMAGE}" AS install_cp2k
RUN dnf -qy install \
g++ gcc gfortran \
python3 \
liblsan \
&& 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"]