1FROM afni/afni_dev_base
2
3ENV PATH=$DESTDIR/usr/local/bin:$PATH
4
5# Env variable, available only at build time of docker image to enable a
6# coverage build. Should be set to true or false
7ARG AFNI_WITH_COVERAGE="0"
8
9# Copy AFNI source code. This will likely invalidate the build cache.
10COPY --chown=$CONTAINER_UID:$CONTAINER_GID . $AFNI_ROOT/
11
12WORKDIR $AFNI_ROOT/../build
13
14RUN \
15    export CC=`which gcc`;\
16    if [[ "$AFNI_WITH_COVERAGE" != "0" ]];then\
17        export CXXFLAGS="-g -O0 -Wall -W -Wshadow -Wunused-variable -Wunused-parameter -Wunused-function -Wunused -Wno-system-headers -Wno-deprecated -Woverloaded-virtual -Wwrite-strings -fprofile-arcs -ftest-coverage"; \
18        export CFLAGS="-g -O0 -Wall -W -fprofile-arcs -ftest-coverage"; \
19        export LDFLAGS="-fprofile-arcs -ftest-coverage";\
20    fi; \
21    cmake \
22        -GNinja \
23        -DCOMP_BINARIES=ON \
24        -DUSE_SYSTEM_NIFTI=OFF \
25        -DUSE_SYSTEM_GIFTI=OFF \
26        -DCOMP_GUI=ON \
27        -DCOMP_PLUGINS=ON \
28        -DUSE_OMP=ON \
29        $AFNI_ROOT
30
31RUN /bin/bash -oc pipefail \
32'ninja -v 2>&1 | tee verbose_build.log && test ${PIPESTATUS[0]} -eq 0'
33
34# install provided it is not a coverage build (which is much larger and so not installed)
35RUN if [[ "$AFNI_WITH_COVERAGE" == "0" ]];then ninja install && fix-permissions $DESTDIR;fi
36
37# For any variables that should be present for all users of the container they
38# should be set in /etc/environment (variables set by ENV do not cleanly
39# propagate to all users'
40USER root
41RUN bash -c 'echo PATH=${PATH} >> /etc/environment'
42USER $CONTAINER_UID
43
44WORKDIR /home/afni_user/work
45# RUN apsearch -update_all_afni_help
46