From 4503e9ef02a90908429baf19724ebe0c7175fb27 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Feb 2017 10:29:23 -0800 Subject: [PATCH 1/5] fix conda permissions (#1806 / https://github.com/nipy/nipype/pull/1806#issuecomment-280649028) --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 16a44fd99e..88532df488 100644 --- a/Dockerfile +++ b/Dockerfile @@ -182,7 +182,8 @@ RUN conda config --add channels conda-forge --add channels intel && \ libxslt=1.1.29 \ traits=4.6.0 \ psutil=5.0.1 \ - icu=58.1 + icu=58.1 && \ + find /usr/local/miniconda/ -exec chmod 775 {} + # matplotlib cleanups: set default backend, precaching fonts RUN sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python3.5/site-packages/matplotlib/mpl-data/matplotlibrc && \ From acb5d1a1dbe8b5860232a4efe704c359051ea7d0 Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Feb 2017 10:36:52 -0800 Subject: [PATCH 2/5] retry docker builds automatically to avoid the "Action failed: docker build" error #1823 --- circle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/circle.yml b/circle.yml index 01b0dfd601..49c0b5ad42 100644 --- a/circle.yml +++ b/circle.yml @@ -34,9 +34,9 @@ dependencies: - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - e=1 && for i in {1..5}; do docker build -t nipype/nipype:latest --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg VERSION=$CIRCLE_TAG . && e=0 && break || sleep 15; done && [ "$e" -eq "0" ] : timeout: 21600 - - docker build -f docker/Dockerfile_py27 -t nipype/nipype_test:py27 . : + - e=1 && for i in {1..5}; do docker build -f docker/Dockerfile_py27 -t nipype/nipype_test:py27 . && e=0 && break || sleep 15; done && [ "$e" -eq "0" ] : timeout: 1600 - - docker build -f docker/Dockerfile_py35 -t nipype/nipype_test:py35 . : + - e=1 && for i in {1..5}; do docker build -f docker/Dockerfile_py35 -t nipype/nipype_test:py35 . && e=0 && break || sleep 15; done && [ "$e" -eq "0" ] : timeout: 1600 - docker save nipype/nipype:latest > $HOME/docker/image.tar - docker save nipype/nipype_test:py27 > $HOME/docker/image27.tar From e7908845476dfa566fda33cb44bcc714dfba077b Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Feb 2017 10:49:48 -0800 Subject: [PATCH 3/5] fix documentation, closes #1816 --- doc/devel/testing_nipype.rst | 43 +++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/doc/devel/testing_nipype.rst b/doc/devel/testing_nipype.rst index 099539260e..2a081dbeda 100644 --- a/doc/devel/testing_nipype.rst +++ b/doc/devel/testing_nipype.rst @@ -107,26 +107,47 @@ This will skip any tests that require matlab. Testing Nipype using Docker --------------------------- -As of :code:`nipype-0.13`, Nipype is tested inside Docker containers. Once the developer -`has installed the Docker Engine `_, testing -Nipype is as easy as follows:: +As of :code:`nipype-0.13`, Nipype is tested inside Docker containers. First, install the +`Docker Engine `_. +Nipype has one base docker image called nipype/nipype, and several additional test images +for various Python versions. + +The base nipype/nipype image is built as follows:: cd path/to/nipype/ - docker build -f docker/nipype_test/Dockerfile_py27 -t nipype/nipype_test:py27 - docker run -it --rm -v /etc/localtime:/etc/localtime:ro \ - -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ + docker build -t nipype/nipype . + +This base image contains several useful tools (FreeSurfer, AFNI, FSL, ANTs, etc.) and +a nipype installation, all in Python 3.5. +It is possible to fetch a built image from the latest master branch of nipype +using:: + + docker run -it --rm nipype/nipype:master + + +The docker run command will then open the container and offer a bash shell for the +developer. + +The additional test images have several test scripts installed. For instance, +to build and run all tests on Python 2.7:: + + cd path/to/nipype/ + docker build -f docker/Dockerfile_py27 -t nipype/nipype_test:py27 . + docker run -it --rm -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ -v ~/examples:/root/examples:ro \ -v ~/scratch:/scratch \ -w /root/src/nipype \ - nipype/nipype_test:py27 /usr/bin/run_pytest.sh + nipype/nipype_test:py27 /usr/bin/run_pytests.sh For running nipype in Python 3.5:: cd path/to/nipype/ - docker build -f docker/nipype_test/Dockerfile_py35 -t nipype/nipype_test:py35 - docker run -it --rm -v /etc/localtime:/etc/localtime:ro \ - -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ + docker build -f docker/Dockerfile_py35 -t nipype/nipype_test:py35 . + docker run -it --rm -e FSL_COURSE_DATA="/root/examples/nipype-fsl_course_data" \ -v ~/examples:/root/examples:ro \ -v ~/scratch:/scratch \ -w /root/src/nipype \ - nipype/nipype_test:py35 /usr/bin/run_pytest.sh + nipype/nipype_test:py35 /usr/bin/run_pytests.sh + +The last two examples assume that the example data is downladed into ~/examples and +the ~/scratch folder will be created if it does not exist previously. From 9b28cc8f868197fd7bc5256e9baa93dccd0aee2f Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Feb 2017 10:54:06 -0800 Subject: [PATCH 4/5] [skip ci] Update CHANGES --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 2f72451f0a..995e324966 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ Upcoming release 0.13 ===================== +* FIX: Issues in Docker image permissions, and docker documentation (https://github.com/nipy/nipype/pull/1825) * ENH: Revised all Dockerfiles and automated deployment to Docker Hub from CircleCI (https://github.com/nipy/nipype/pull/1815) * FIX: Semaphore capture using MultiProc plugin (https://github.com/nipy/nipype/pull/1689) From 02fe28e2c17d3e3cc1b8bb5dc6099435fc4cfdcc Mon Sep 17 00:00:00 2001 From: oesteban Date: Fri, 17 Feb 2017 12:41:51 -0800 Subject: [PATCH 5/5] improve docker image caching in circle --- circle.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/circle.yml b/circle.yml index 49c0b5ad42..5567a6abb7 100644 --- a/circle.yml +++ b/circle.yml @@ -28,9 +28,8 @@ dependencies: - if [[ ! -d ~/examples/nipype-tutorial ]]; then wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q -O nipype-tutorial.tar.bz2 "${DATA_NIPYPE_TUTORIAL_URL}" && tar xjf nipype-tutorial.tar.bz2 -C ~/examples/; fi - if [[ ! -d ~/examples/nipype-fsl_course_data ]]; then wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q -O nipype-fsl_course_data.tar.gz "${DATA_NIPYPE_FSL_COURSE}" && tar xzf nipype-fsl_course_data.tar.gz -C ~/examples/; fi - if [[ ! -d ~/examples/feeds ]]; then wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q -O fsl-5.0.9-feeds.tar.gz "${DATA_NIPYPE_FSL_FEEDS}" && tar xzf fsl-5.0.9-feeds.tar.gz -C ~/examples/; fi - - if [[ -e $HOME/docker/image.tar ]]; then docker load -i $HOME/docker/image.tar; fi - - if [[ -e $HOME/docker/image27.tar ]]; then docker load -i $HOME/docker/image27.tar; fi - - if [[ -e $HOME/docker/image35.tar ]]; then docker load -i $HOME/docker/image35.tar; fi + - if [[ -e $HOME/docker/image.tar ]]; then docker load --input $HOME/docker/image.tar; else echo 'No docker image found in cache'; fi + - docker images - sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'$CIRCLE_TAG'/" nipype/info.py - e=1 && for i in {1..5}; do docker build -t nipype/nipype:latest --build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg VERSION=$CIRCLE_TAG . && e=0 && break || sleep 15; done && [ "$e" -eq "0" ] : timeout: 21600 @@ -38,9 +37,8 @@ dependencies: timeout: 1600 - e=1 && for i in {1..5}; do docker build -f docker/Dockerfile_py35 -t nipype/nipype_test:py35 . && e=0 && break || sleep 15; done && [ "$e" -eq "0" ] : timeout: 1600 - - docker save nipype/nipype:latest > $HOME/docker/image.tar - - docker save nipype/nipype_test:py27 > $HOME/docker/image27.tar - - docker save nipype/nipype_test:py35 > $HOME/docker/image35.tar + - docker save -o $HOME/docker/image.tar nipype/nipype:latest nipype/nipype_test:py27 nipype/nipype_test:py35 : + timeout: 1600 test: override: