mirror of
https://github.com/cp2k/cp2k.git
synced 2026-07-28 14:15:19 -04:00
83 lines
2.1 KiB
Text
83 lines
2.1 KiB
Text
#
|
|
# This file was created by generate_dockerfiles.py.
|
|
# Usage: docker build -f ./Dockerfile.test_cmake ../../
|
|
#
|
|
|
|
FROM ubuntu:24.04
|
|
|
|
# Install common dependencies as pre-built Ubuntu packages.
|
|
RUN apt-get update -qq && apt-get install -qq --no-install-recommends \
|
|
autoconf \
|
|
autogen \
|
|
automake \
|
|
autotools-dev \
|
|
bzip2 \
|
|
ca-certificates \
|
|
g++ \
|
|
gcc \
|
|
gfortran \
|
|
git \
|
|
less \
|
|
libtool \
|
|
libtool-bin \
|
|
make \
|
|
nano \
|
|
ninja-build \
|
|
patch \
|
|
pkgconf \
|
|
python3 \
|
|
unzip \
|
|
wget \
|
|
xxd \
|
|
zlib1g-dev \
|
|
cmake \
|
|
gnupg \
|
|
m4 \
|
|
xz-utils \
|
|
libssl-dev \
|
|
libssh-dev \
|
|
hwloc \
|
|
libhwloc-dev \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
# Install a recent developer version of Spack.
|
|
WORKDIR /opt/spack
|
|
RUN git init --quiet && \
|
|
git remote add origin https://github.com/spack/spack.git && \
|
|
git fetch --quiet --depth 1 origin tag develop-2024-05-26 --no-tags && \
|
|
git checkout --quiet FETCH_HEAD
|
|
ENV PATH="/opt/spack/bin:${PATH}"
|
|
|
|
# Find all external packages and compilers.
|
|
RUN spack compiler find
|
|
RUN spack external find --all --not-buildable
|
|
|
|
# Install CP2K's dependencies via Spack.
|
|
WORKDIR /
|
|
COPY ./tools/spack/cp2k-dependencies.yaml .
|
|
RUN spack env create myenv ./cp2k-dependencies.yaml
|
|
RUN spack -e myenv concretize -f
|
|
RUN spack -e myenv env depfile -o spack-makefile && make -j32 --file=spack-makefile SPACK_COLOR=never --output-sync=recurse
|
|
|
|
# Install CP2K sources.
|
|
WORKDIR /opt/cp2k
|
|
COPY ./src ./src
|
|
COPY ./data ./data
|
|
COPY ./tests ./tests
|
|
COPY ./tools/build_utils ./tools/build_utils
|
|
COPY ./cmake ./cmake
|
|
COPY ./CMakeLists.txt .
|
|
|
|
# Build CP2K with CMake and run regression tests.
|
|
ARG TESTOPTS=""
|
|
COPY ./tools/docker/scripts/build_cp2k_cmake.sh ./tools/docker/scripts/test_regtest_cmake.sh ./
|
|
RUN /bin/bash -o pipefail -c " \
|
|
TESTOPTS='${TESTOPTS}' \
|
|
./test_regtest_cmake.sh spack psmp |& tee report.log && \
|
|
rm -rf regtesting"
|
|
|
|
# Output the report if the image is old and was therefore pulled from the build cache.
|
|
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
|
|
ENTRYPOINT []
|
|
|
|
#EOF
|