Debian Codegraph @

python_packaging/docker/gromacs.dockerfile

raw
1 # Provide an easy-to-reproduce environment in which to test full Python functionality.
2 # Produce an image with GROMACS installed. Use the root of the repository as the build context
3
4 # Optionally, set `--build-arg DOCKER_CORES=N` for a Docker engine running with access to more than 1 CPU.
5 # REF=`git show -s --pretty=format:"%h"`
6 # docker build -t gmxapi/gromacs-${MPIFLAVOR}:${REF} \
7 # --build-arg DOCKER_CORES=4 \
8 # --build-arg MPIFLAVOR=${MPIFLAVOR} \
9 # -f gromacs.dockerfile ../..
10
11 # This image serves as a base for integration with the gmxapi Python tools and sample code.
12
13 ARG MPIFLAVOR=mpich
14 ARG REF=latest
15 FROM gmxapi/gromacs-dependencies-$MPIFLAVOR:$REF as build
16
17 # We let the sources stay in the intermediate `build` stage, since a little bloat here shouldn't
18 #impact the size of the final containers unless we copy explicitly (see below)
19 ENV SRC_DIR /gromacs-source
20 COPY . $SRC_DIR
21
22 ENV BUILD_DIR /tmp/gromacs-build
23 RUN mkdir -p $BUILD_DIR
24 WORKDIR $BUILD_DIR
25
26 ARG DOCKER_CORES=1
27 # Allow the build type to be specified with `docker build --build-arg TYPE=something`
28 ARG TYPE=Release
29 RUN cmake $SRC_DIR \
30 -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs \
31 -DGMXAPI=ON \
32 -DGMX_THREAD_MPI=ON \
33 -DGMX_BUILD_HELP=OFF \
34 -DGMX_USE_RDTSCP=OFF \
35 -DGMX_INSTALL_LEGACY_API=ON \
36 -DCMAKE_BUILD_TYPE=$TYPE
37 RUN make -j$DOCKER_CORES
38 RUN make -j$DOCKER_CORES tests
39 RUN make -j$DOCKER_CORES install
40
41 FROM gmxapi/gromacs-dependencies-$MPIFLAVOR:$REF
42
43 COPY --from=build /usr/local/gromacs /usr/local/gromacs
44 # The following can be essential for troubleshooting, but we should suppress it for containers
45 # that will be uploaded and shared.
46 #COPY --from=build /gromacs-source /gromacs-source