/
Dockerfile
155 lines (136 loc) · 6.1 KB
/
Dockerfile
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# Use Ubuntu 16.04 LTS
FROM ubuntu:xenial-20161213
# Pre-cache neurodebian key
COPY docker/files/neurodebian.gpg /root/.neurodebian.gpg
# Prepare environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
bzip2 \
ca-certificates \
cython3 \
build-essential \
autoconf \
libtool \
pkg-config && \
curl -sSL http://neuro.debian.net/lists/xenial.us-ca.full >> /etc/apt/sources.list.d/neurodebian.sources.list && \
apt-key add /root/.neurodebian.gpg && \
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
# Installing Neurodebian packages (FSL, git)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
fsl-core \
fsl-mni152-templates
ENV FSLDIR=/usr/share/fsl/5.0 \
FSLOUTPUTTYPE=NIFTI_GZ \
FSLMULTIFILEQUIT=TRUE \
POSSUMDIR=/usr/share/fsl/5.0 \
LD_LIBRARY_PATH=/usr/lib/fsl/5.0:$LD_LIBRARY_PATH \
FSLTCLSH=/usr/bin/tclsh \
FSLWISH=/usr/bin/wish \
PATH=/usr/lib/fsl/5.0:/usr/lib/afni/bin:$PATH
# Installing AFNI (version 17_3_03 archived on OSF)
RUN apt-get update -qq && apt-get install -yq --no-install-recommends ed gsl-bin libglu1-mesa-dev libglib2.0-0 libglw1-mesa \
libgomp1 libjpeg62 libxm4 netpbm tcsh xfonts-base xvfb && \
libs_path=/usr/lib/x86_64-linux-gnu && \
if [ -f $libs_path/libgsl.so.19 ]; then \
ln $libs_path/libgsl.so.19 $libs_path/libgsl.so.0; \
fi && \
echo "Install libxp (not in all ubuntu/debian repositories)" && \
apt-get install -yq --no-install-recommends libxp6 \
|| /bin/bash -c " \
curl --retry 5 -o /tmp/libxp6.deb -sSL http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
&& dpkg -i /tmp/libxp6.deb && rm -f /tmp/libxp6.deb" && \
echo "Install libpng12 (not in all ubuntu/debian repositories" && \
apt-get install -yq --no-install-recommends libpng12-0 \
|| /bin/bash -c " \
curl -o /tmp/libpng12.deb -sSL http://mirrors.kernel.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
&& dpkg -i /tmp/libpng12.deb && rm -f /tmp/libpng12.deb" && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
mkdir -p /opt/afni && \
curl -o afni.tar.gz -sSLO "https://files.osf.io/v1/resources/fvuh8/providers/osfstorage/5a0dd9a7b83f69027512a12b" && \
tar zxv -C /opt/afni --strip-components=1 -f afni.tar.gz && \
rm -rf afni.tar.gz
ENV PATH=/opt/afni:$PATH
# Installing and setting up ANTs
RUN mkdir -p /opt/ants && \
curl -sSL "https://github.com/stnava/ANTs/releases/download/v2.1.0/Linux_Ubuntu14.04.tar.bz2" \
| tar -xjC /opt/ants --strip-components 1
ENV ANTSPATH=/opt/ants \
PATH=/opt/ants:$PATH
# Installing WEBP tools
RUN curl -sSLO "http://downloads.webmproject.org/releases/webp/libwebp-0.5.2-linux-x86-64.tar.gz" && \
tar -xf libwebp-0.5.2-linux-x86-64.tar.gz && cd libwebp-0.5.2-linux-x86-64/bin && \
mv cwebp /usr/local/bin/ && rm -rf libwebp-0.5.2-linux-x86-64
# Installing SVGO
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
RUN apt-get install -y nodejs
RUN npm install -g svgo
# Installing Ubuntu packages and cleaning up
RUN apt-get install -y --no-install-recommends \
git=1:2.7.4-0ubuntu1 \
graphviz=2.38.0-12ubuntu2 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Installing and setting up miniconda
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.3.11-Linux-x86_64.sh && \
bash Miniconda3-4.3.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
rm Miniconda3-4.3.11-Linux-x86_64.sh
ENV PATH=/usr/local/miniconda/bin:$PATH \
LANG=C.UTF-8 \
LC_ALL=C.UTF-8
# Installing precomputed python packages
RUN conda install -c conda-forge -y openblas=0.2.19; \
sync && \
conda install -c conda-forge -y \
numpy=1.12.0 \
cython \
scipy=0.19.0 \
matplotlib=2.0.0 \
pandas=0.19.2 \
libxml2=2.9.4 \
libxslt=1.1.29 \
sympy=1.0 \
statsmodels=0.8.0 \
dipy=0.11.0 \
traits=4.6.0 \
psutil=5.2.2 \
sphinx=1.5.4; \
sync && \
chmod -R a+rX /usr/local/miniconda && \
chmod +x /usr/local/miniconda/bin/* && \
conda clean --all -y; sync && \
python -c "from matplotlib import font_manager" && \
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
# Unless otherwise specified each process should only use one thread - nipype
# will handle parallelization
ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1
# Installing dev requirements (packages that are not in pypi)
WORKDIR /usr/local/src/mriqc
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt && \
rm -rf ~/.cache/pip
# Precaching atlases after niworkflows is available
RUN mkdir /niworkflows_data
ENV CRN_SHARED_DATA /niworkflows_data
RUN python -c 'from niworkflows.data.getters import get_mni_icbm152_nlin_asym_09c; get_mni_icbm152_nlin_asym_09c()'
# Installing MRIQC
COPY . /usr/local/src/mriqc
ARG VERSION
RUN echo "${VERSION}" > mriqc/VERSION && \
pip install .[all] && \
rm -rf ~/.cache/pip
RUN ldconfig
ENTRYPOINT ["/usr/local/miniconda/bin/mriqc"]
# Store metadata
ARG BUILD_DATE
ARG VCS_REF
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="MRIQC" \
org.label-schema.description="MRIQC - Automated Quality Control and visual reports for Quality Assesment of structural (T1w, T2w) and functional MRI of the brain" \
org.label-schema.url="http://mriqc.readthedocs.io" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.vcs-url="https://github.com/poldracklab/mriqc" \
org.label-schema.version=$VERSION \
org.label-schema.schema-version="1.0"