Let base GROMACS docker image be a little more useful.
[gromacs.git] / python_packaging / docker / gromacs.dockerfile
blob0e2d0d665ac23cd14e7f72e4ad7d5b596f96707f
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
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 ../..
8 # This image serves as a base for integration with the gmxapi Python tools and sample code.
10 ARG MPIFLAVOR=mpich
11 ARG REF=latest
12 FROM gmxapi/gromacs-dependencies-$MPIFLAVOR:$REF
14 ENV SRC_DIR /tmp/gromacs-source
15 COPY . $SRC_DIR
17 ENV BUILD_DIR /tmp/gromacs-build
18 RUN mkdir -p $BUILD_DIR
19 WORKDIR $BUILD_DIR
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 # Note: AVX2 instructions not available in older docker engines.
25 RUN cmake $SRC_DIR \
26         -DCMAKE_INSTALL_PREFIX=/usr/local/gromacs \
27         -DGMXAPI=ON \
28         -DGMX_THREAD_MPI=ON \
29         -DGMX_BUILD_HELP=OFF \
30         -DGMX_SIMD=AVX_256 \
31         -DGMX_USE_RDTSCP=OFF \
32         -DGMX_HWLOC=OFF \
33         -DCMAKE_BUILD_TYPE=$TYPE
34 RUN make -j$DOCKER_CORES
35 RUN make -j$DOCKER_CORES tests
36 RUN make -j$DOCKER_CORES install
38 # Default command provided for convenience since it inherits WORKDIR from above.
39 CMD make check