34482daf22bc29aed5dbc55723ccbcec679d0fce
[alexxy/gromacs.git] / python_packaging / docker / gromacs.dockerfile
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:${REF} --build-arg DOCKER_CORES=4 -f gromacs.dockerfile ../..
7
8 # This image serves as a base for integration with the gmxapi Python tools and sample code.
9
10 ARG MPIFLAVOR=mpich
11 ARG REF=latest
12 FROM gmxapi/gromacs-dependencies-$MPIFLAVOR:$REF
13
14 ENV SRC_DIR /tmp/gromacs-source
15 COPY . $SRC_DIR
16
17 ENV BUILD_DIR /tmp/gromacs-build
18 RUN mkdir -p $BUILD_DIR
19 WORKDIR $BUILD_DIR
20
21 ARG DOCKER_CORES=1
22 # Allow the build type to be specified with `docker build --build-arg TYPE=something`
23 ARG TYPE=Release
24 RUN cmake $SRC_DIR \
25         -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs \
26         -DGMXAPI=ON \
27         -DGMX_THREAD_MPI=ON \
28         -DGMX_BUILD_HELP=OFF \
29         -DGMX_REQUIRE_VALID_TOOLCHAIN=TRUE \
30         -DCMAKE_BUILD_TYPE=$TYPE
31 RUN make -j$DOCKER_CORES
32 RUN make -j$DOCKER_CORES tests
33 RUN make -j$DOCKER_CORES install
34
35 # Default command provided for convenience since it inherits WORKDIR from above.
36 CMD make check