|
| 1 | +# Copyright (c) 2016, The developers of the Stanford CRN |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# Redistribution and use in source and binary forms, with or without |
| 5 | +# modification, are permitted provided that the following conditions are met: |
| 6 | +# |
| 7 | +# * Redistributions of source code must retain the above copyright notice, this |
| 8 | +# list of conditions and the following disclaimer. |
| 9 | +# |
| 10 | +# * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | +# this list of conditions and the following disclaimer in the documentation |
| 12 | +# and/or other materials provided with the distribution. |
| 13 | +# |
| 14 | +# * Neither the name of crn_base nor the names of its |
| 15 | +# contributors may be used to endorse or promote products derived from |
| 16 | +# this software without specific prior written permission. |
| 17 | +# |
| 18 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
| 22 | +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 23 | +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 25 | +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 26 | +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 27 | +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 | + |
| 29 | + |
| 30 | +# |
| 31 | +# Based on https://github.com/poldracklab/fmriprep/blob/9c92a3de9112f8ef1655b876de060a2ad336ffb0/Dockerfile |
| 32 | +# |
| 33 | +FROM nipype/base:latest |
| 34 | +MAINTAINER The nipype developers https://github.com/nipy/nipype |
| 35 | + |
| 36 | +ARG PYTHON_VERSION_MAJOR=3 |
| 37 | + |
| 38 | +# Installing and setting up miniconda |
| 39 | +RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda${PYTHON_VERSION_MAJOR}-4.2.12-Linux-x86_64.sh && \ |
| 40 | + bash Miniconda${PYTHON_VERSION_MAJOR}-4.2.12-Linux-x86_64.sh -b -p /usr/local/miniconda && \ |
| 41 | + rm Miniconda${PYTHON_VERSION_MAJOR}-4.2.12-Linux-x86_64.sh |
| 42 | + |
| 43 | +ENV PATH=/usr/local/miniconda/bin:$PATH \ |
| 44 | + LANG=C.UTF-8 \ |
| 45 | + LC_ALL=C.UTF-8 \ |
| 46 | + ACCEPT_INTEL_PYTHON_EULA=yes \ |
| 47 | + MKL_NUM_THREADS=1 \ |
| 48 | + OMP_NUM_THREADS=1 |
| 49 | +# MKL/OMP_NUM_THREADS: unless otherwise specified, each process should |
| 50 | +# only use one thread - nipype will handle parallelization |
| 51 | + |
| 52 | +# Installing precomputed python packages |
| 53 | +ARG PYTHON_VERSION_MINOR=6 |
| 54 | +RUN conda config --add channels conda-forge; sync && \ |
| 55 | + conda config --set always_yes yes --set changeps1 no; sync && \ |
| 56 | + conda install -y python=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} \ |
| 57 | + mkl \ |
| 58 | + numpy \ |
| 59 | + scipy \ |
| 60 | + scikit-learn \ |
| 61 | + matplotlib \ |
| 62 | + pandas \ |
| 63 | + libxml2 \ |
| 64 | + libxslt \ |
| 65 | + traits=4.6.0 \ |
| 66 | + psutil \ |
| 67 | + paramiko \ |
| 68 | + icu=58.1 && \ |
| 69 | + sync; |
| 70 | + |
| 71 | +# matplotlib cleanups: set default backend, precaching fonts |
| 72 | +RUN sed -i 's/\(backend *: \).*$/\1Agg/g' /usr/local/miniconda/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/matplotlib/mpl-data/matplotlibrc && \ |
| 73 | + python -c "from matplotlib import font_manager" |
| 74 | + |
| 75 | +# Install CI scripts |
| 76 | +COPY docker/files/run_* /usr/bin/ |
| 77 | +RUN chmod +x /usr/bin/run_* |
| 78 | + |
| 79 | +# Replace imglob with a Python3 compatible version |
| 80 | +COPY nipype/external/fsl_imglob.py /usr/bin/fsl_imglob.py |
| 81 | +RUN rm -rf ${FSLDIR}/bin/imglob && \ |
| 82 | + chmod +x /usr/bin/fsl_imglob.py && \ |
| 83 | + ln -s /usr/bin/fsl_imglob.py ${FSLDIR}/bin/imglob |
| 84 | + |
| 85 | +# Installing dev requirements (packages that are not in pypi) |
| 86 | +WORKDIR /src/ |
| 87 | +COPY requirements.txt requirements.txt |
| 88 | +RUN pip install -r requirements.txt && \ |
| 89 | + rm -rf ~/.cache/pip |
| 90 | + |
| 91 | +# Installing nipype |
| 92 | +COPY . /src/nipype |
| 93 | +RUN cd /src/nipype && \ |
| 94 | + pip install -e .[all] && \ |
| 95 | + rm -rf ~/.cache/pip |
| 96 | + |
| 97 | +WORKDIR /work/ |
| 98 | + |
| 99 | +ARG BUILD_DATE |
| 100 | +ARG VCS_REF |
| 101 | +ARG VERSION |
| 102 | +LABEL org.label-schema.build-date=$BUILD_DATE \ |
| 103 | + org.label-schema.name="NIPYPE" \ |
| 104 | + org.label-schema.description="NIPYPE - Neuroimaging in Python: Pipelines and Interfaces" \ |
| 105 | + org.label-schema.url="http://nipype.readthedocs.io" \ |
| 106 | + org.label-schema.vcs-ref=$VCS_REF \ |
| 107 | + org.label-schema.vcs-url="https://github.com/nipy/nipype" \ |
| 108 | + org.label-schema.version=$VERSION \ |
| 109 | + org.label-schema.schema-version="1.0" |
0 commit comments