File: ci.dockerfile

package info (click to toggle)
gromacs 2026~rc-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 274,216 kB
  • sloc: xml: 3,831,143; cpp: 686,111; ansic: 75,300; python: 21,171; sh: 3,553; perl: 2,246; yacc: 644; fortran: 397; lisp: 265; makefile: 174; lex: 125; awk: 68; csh: 39
file content (109 lines) | stat: -rw-r--r-- 3,883 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Provide an easy-to-reproduce environment in which to test full Python functionality.

# Run with default command or specify one of the scripts to be executed through the entrypoint.
#
#    docker run --rm -ti gmxapi/ci-mpich:fr1 integrationtest
#
# Building:
#
# Requires Docker 17.05 or higher.
#
# Note to maintainers:
# Build from the GROMACS image at the current fork point. Tag with the feature
# name or the current revision.
#
#    FORKPOINT=$(git show -s --pretty=format:"%h" `git merge-base main HEAD`)
#    REF=`git show -s --pretty=format:"%h"`
#    # or
#    REF="fr1"
#    docker build -t gmxapi/ci-mpich:${REF} --build-arg REF=${FORKPOINT} -f ci.dockerfile ..
#

ARG REF=latest
ARG MPIFLAVOR=mpich

FROM gmxapi/gromacs-dependencies-$MPIFLAVOR as python-base

RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -yq --no-install-suggests --no-install-recommends \
    install \
        python3 \
        python3-dev \
        python3-venv && \
    rm -rf /var/lib/apt/lists/*

# TODO: Use non-system Python installations for explicit version coverage.
# Consider pyenv for generic management of Python environment.

RUN groupadd -r testing && useradd -m -s /bin/bash -g testing testing

USER testing

ENV VENV /home/testing/venv
RUN python3 -m venv $VENV
RUN . $VENV/bin/activate && \
    pip install --no-cache-dir --upgrade pip setuptools wheel

#
# Use gromacs installation from gmxapi/gromacs image
#

FROM gmxapi/gromacs-$MPIFLAVOR:$REF as gromacs
# This intermediate is necessary because the COPY command does not support syntax like the following:
#COPY --from=gmxapi/gromacs:$REF /usr/local/gromacs /usr/local/gromacs

FROM python-base

COPY --from=gromacs /usr/local/gromacs /usr/local/gromacs

RUN $VENV/bin/python -m pip install --upgrade pip setuptools wheel

ADD --chown=testing:testing gmxapi /home/testing/gmxapi
ADD --chown=testing:testing sample_restraint /home/testing/sample_restraint
RUN $VENV/bin/python -m pip install --no-cache-dir --no-build-isolation -r /home/testing/gmxapi/requirements.txt

# We use "--no-cache-dir" to reduce Docker image size.
RUN . $VENV/bin/activate && \
    (cd $HOME/gmxapi && \
     CMAKE_ARGS="-Dgmxapi_ROOT=/usr/local/gromacs -C /usr/local/gromacs/share/cmake/gromacs/gromacs-hints.cmake" \
      pip install --no-cache-dir --verbose . \
    )

ADD --chown=testing:testing sample_restraint /home/testing/sample_restraint

# To test behavior as in GitLab CI, copy the googletest sources, export CI=1 to the cmake
# configure command, and remove the option to download googletest.
#COPY --from=gromacs /gromacs-source/src/external/googletest /home/testing/sample_restraint/external/googletest
RUN cmake --version
RUN . $VENV/bin/activate && \
    . /usr/local/gromacs/bin/GMXRC && \
    (cd $HOME/sample_restraint && \
     mkdir build && \
     cd build && \
     cmake .. \
             -C /usr/local/gromacs/share/cmake/gromacs/gromacs-hints.cmake \
             -DPYTHON_EXECUTABLE=$VENV/bin/python \
             -DDOWNLOAD_GOOGLETEST=ON \
             -DGMXAPI_EXTENSION_DOWNLOAD_PYBIND=ON && \
     make -j4 && \
     make tests && \
     make test && \
     make install \
    )

ADD --chown=testing:testing src/test /home/testing/gmxapi/test
ADD scripts /docker_entry_points
COPY docker/entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh"]
CMD ["run_full"]


# MPI tests can be run in this container without requiring MPI on the host.
# (We suggest running your docker engine with multiple CPU cores allocated.)
#     docker run --rm -t gmxapi/ci:${REF} /home/testing/scripts/run_full_mpi.sh
# We should also try tests with an MPI-connected set of docker containers.

# To be able to step through with gdb, run with something like the following, replacing
# 'imagename' with the name of the docker image built with this recipe.
# docker run --rm -ti --security-opt seccomp=unconfined imagename bash