Docker: Add README and small tweaks

This commit is contained in:
Ole Schütt 2022-02-25 11:04:11 +01:00 committed by Ole Schütt
parent e385615c00
commit 0090174fbb
43 changed files with 116 additions and 62 deletions

View file

@ -85,7 +85,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local_cuda VERSION=psmp && \
rm -rf lib obj exe/local_cuda/*_unittest.psmp"
rm -rf lib obj exe/local_cuda/libcp2k_unittest.psmp"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -99,7 +99,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local_cuda", "psmp"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local_cuda", "psmp"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -85,7 +85,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local_cuda VERSION=psmp && \
rm -rf lib obj exe/local_cuda/*_unittest.psmp"
rm -rf lib obj exe/local_cuda/libcp2k_unittest.psmp"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -99,7 +99,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local_cuda", "psmp"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local_cuda", "psmp"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -85,7 +85,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local_cuda VERSION=psmp && \
rm -rf lib obj exe/local_cuda/*_unittest.psmp"
rm -rf lib obj exe/local_cuda/libcp2k_unittest.psmp"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -99,7 +99,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local_cuda", "psmp"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local_cuda", "psmp"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -73,7 +73,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local VERSION=pdbg && \
rm -rf lib obj exe/local/*_unittest.pdbg"
rm -rf lib obj exe/local/libcp2k_unittest.pdbg"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -87,7 +87,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local", "pdbg"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local", "pdbg"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -73,7 +73,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local VERSION=psmp && \
rm -rf lib obj exe/local/*_unittest.psmp"
rm -rf lib obj exe/local/libcp2k_unittest.psmp"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -87,7 +87,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local", "psmp"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local", "psmp"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -73,7 +73,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local VERSION=sdbg && \
rm -rf lib obj exe/local/*_unittest.sdbg"
rm -rf lib obj exe/local/libcp2k_unittest.sdbg"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -87,7 +87,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local", "sdbg"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local", "sdbg"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -73,7 +73,7 @@ RUN /bin/bash -c " \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local VERSION=ssmp && \
rm -rf lib obj exe/local/*_unittest.ssmp"
rm -rf lib obj exe/local/libcp2k_unittest.ssmp"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -87,7 +87,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "local", "ssmp"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "local", "ssmp"]
CMD ["cp2k", "--help"]
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_aiida.sh .
RUN ./test_aiida.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_ase.sh .
RUN ./test_ase.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -ec " \
./test_conventions.sh |& tee report.log"
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_coverage.sh .
RUN ./test_coverage.sh "pdbg" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_coverage.sh .
RUN ./test_coverage.sh "sdbg" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -96,6 +96,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -96,6 +96,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -96,6 +96,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -24,6 +24,6 @@ COPY ./tools/docker/scripts/test_doxygen.sh .
RUN ./test_doxygen.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -110,6 +110,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -110,6 +110,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -110,6 +110,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -110,6 +110,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_gromacs.sh .
RUN ./test_gromacs.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -174,6 +174,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -174,6 +174,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -174,6 +174,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -100,6 +100,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -100,6 +100,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -80,6 +80,6 @@ COPY ./tools/docker/scripts/test_i-pi.sh .
RUN ./test_i-pi.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -110,6 +110,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -72,8 +72,7 @@ RUN /bin/bash -c " \
ln -vs /opt/cp2k-toolchain/install/arch/local.psmp ./arch/ && \
echo 'Compiling cp2k...' && \
source /opt/cp2k-toolchain/install/setup && \
make -j ARCH=local VERSION=psmp && \
rm -rf lib obj exe/local/*_unittest.psmp"
( make -j ARCH=local VERSION=psmp &> /dev/null || true )"
COPY ./data ./data
COPY ./tests ./tests
COPY ./tools/regtesting ./tools/regtesting
@ -85,6 +84,6 @@ COPY ./tools/docker/scripts/test_manual.sh .
RUN ./test_manual.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -83,6 +83,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -83,6 +83,6 @@ COPY ./tools/docker/scripts/test_performance.sh \
RUN ./test_performance.sh "local" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -95,6 +95,6 @@ COPY ./tools/docker/scripts/test_performance.sh \
RUN ./test_performance.sh "local_cuda" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -95,6 +95,6 @@ COPY ./tools/docker/scripts/test_performance.sh \
RUN ./test_performance.sh "local_cuda" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -95,6 +95,6 @@ COPY ./tools/docker/scripts/test_performance.sh \
RUN ./test_performance.sh "local_cuda" 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -24,6 +24,6 @@ COPY ./tools/docker/scripts/test_python.sh .
RUN ./test_python.sh 2>&1 | tee report.log
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

View file

@ -84,6 +84,6 @@ RUN /bin/bash -c " \
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 +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF

45
tools/docker/README.md Normal file
View file

@ -0,0 +1,45 @@
# Docker Containers
This directory hosts docker files for testing and running cp2k.
The only prerequisite is to [install Docker](https://docs.docker.com/get-docker/).
## Production Images
1. Build the container image:
<!-- markdownlint-disable MD013 -->
```shell
docker build -f Dockerfile.prod_psmp --build-arg GIT_COMMIT_SHA=$(git rev-parse HEAD) -t cp2k_prod_psmp ../../
```
<!-- markdownlint-enable MD013 -->
2. Goto the directory with your input files:
```shell
cd ../../benchmarks/QS_single_node
```
3. Run the container:
<!-- markdownlint-disable MD013 -->
```shell
docker run -ti -v "$(pwd)":/mnt cp2k_prod_psmp mpiexec -genv OMP_NUM_THREADS=2 -np 16 cp2k dbcsr.inp
```
<!-- markdownlint-enable MD013 -->
## Test Images
The `Dockerfile.test_*` file are used by the [cp2k-ci](github.com/cp2k/cp2k-ci)
to check pull requests. and populate the [dashboard](http:s//dashboard.cp2k.org).
Building a test image executes the test:
```shell
docker build -f Dockerfile.test_sdbg -t cp2k_test_sdbg ../../
```
To retrieve the cached report of an old image simply run it:
```shell
docker run cp2k_test_sdbg
```

View file

@ -78,7 +78,7 @@ def main() -> None:
# ======================================================================================
def regtest(version: str, arch: str = "local") -> str:
return (
install_cp2k(version=version, arch=arch, prod=False)
install_cp2k(version=version, arch=arch)
+ fr"""
# Run regression tests.
ARG TESTOPTS
@ -95,7 +95,7 @@ RUN /bin/bash -c " \
# ======================================================================================
def performance(arch: str = "local") -> str:
return (
install_cp2k(version="psmp", arch=arch, prod=False)
install_cp2k(version="psmp", arch=arch)
+ fr"""
# Run performance test for {arch}.
COPY ./benchmarks ./benchmarks
@ -111,7 +111,7 @@ RUN ./test_performance.sh "{arch}" 2>&1 | tee report.log
# ======================================================================================
def coverage(version: str) -> str:
return (
install_cp2k(version=version, arch="local_coverage", prod=False)
install_cp2k(version=version, arch="local_coverage")
+ fr"""
# Run coverage test for {version}.
COPY ./tools/docker/scripts/test_coverage.sh .
@ -124,7 +124,7 @@ RUN ./test_coverage.sh "{version}" 2>&1 | tee report.log
# ======================================================================================
def conventions() -> str:
return (
install_cp2k(version="psmp", arch="local_warn", prod=False)
install_cp2k(version="psmp", arch="local_warn")
+ fr"""
# Run test for conventions.
COPY ./arch/Linux-x86-64-gfortran.dumpast ./arch/
@ -141,7 +141,7 @@ RUN /bin/bash -ec " \
# ======================================================================================
def manual() -> str:
return (
install_cp2k(version="psmp", arch="local", prod=True) # prod has REVISION set
install_cp2k(version="psmp", arch="local", revision=True)
+ fr"""
# Generate manual.
COPY ./tools/manual ./tools/manual
@ -156,7 +156,7 @@ RUN ./test_manual.sh 2>&1 | tee report.log
# ======================================================================================
def test_3rd_party(name: str) -> str:
return (
install_cp2k(version="sdbg", arch="local", prod=False)
install_cp2k(version="sdbg", arch="local")
+ fr"""
# Run test for {name}.
COPY ./tools/docker/scripts/test_{name}.sh .
@ -198,7 +198,7 @@ RUN ./test_{name}.sh 2>&1 | tee report.log
def print_cached_report() -> str:
return r"""
# Output the report if the image is old and was therefore pulled from the build cache.
CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
CMD cat $(find ./report.log -mmin +10) | sed '/^Summary:/ s/$/ (cached)/'
#EOF
"""
@ -207,7 +207,7 @@ CMD cat $(find ./report.log -mmin +3) | sed '/^Summary:/ s/$/ (cached)/'
# ======================================================================================
def production(version: str, arch: str = "local") -> str:
return (
install_cp2k(version=version, arch=arch, prod=True)
install_cp2k(version=version, arch=arch, revision=True, prod=True)
+ fr"""
# Run regression tests.
ARG TESTOPTS
@ -218,7 +218,8 @@ RUN /bin/bash -c " \
# Setup entry point for production.
COPY ./tools/docker/scripts/prod_entrypoint.sh ./
ENTRYPOINT ["./prod_entrypoint.sh", "{arch}", "{version}"]
WORKDIR /mnt
ENTRYPOINT ["/workspace/cp2k/prod_entrypoint.sh", "{arch}", "{version}"]
CMD ["cp2k", "--help"]
#EOF
@ -227,11 +228,13 @@ CMD ["cp2k", "--help"]
# ======================================================================================
def install_cp2k(version: str, arch: str, prod: bool) -> str:
def install_cp2k(
version: str, arch: str, revision: bool = False, prod: bool = False
) -> str:
input_lines = []
run_lines = []
if prod:
if revision:
input_lines.append("ARG GIT_COMMIT_SHA")
run_lines.append(
'if [ -n "${GIT_COMMIT_SHA}" ] ; then'
@ -255,7 +258,7 @@ def install_cp2k(version: str, arch: str, prod: bool) -> str:
if prod:
run_lines.append(f"make -j ARCH={arch} VERSION={version}")
run_lines.append(f"rm -rf lib obj exe/{arch}/*_unittest.{version}")
run_lines.append(f"rm -rf lib obj exe/{arch}/libcp2k_unittest.{version}")
else:
run_lines.append(
f"( make -j ARCH={arch} VERSION={version} &> /dev/null || true )"