forked from scitran-apps/afq-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
204 lines (159 loc) · 6.08 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# Create Docker container that can run Matlab (mrDiffusion and afq analysis), ANTs, FSL, mrTrix.
# Start with the Matlab r2017a runtime container
FROM flywheel/matlab-mcr:v92.1
MAINTAINER Michael Perry <[email protected]>
ENV FLYWHEEL /flywheel/v0
WORKDIR ${FLYWHEEL}
# Because we're coming in from a Matlab-MCR we need to unset LD_LIBRARY_PATH
ENV LD_LIBRARY_PATH ""
###########################
# Configure neurodebian (https://github.com/neurodebian/dockerfiles/blob/master/dockerfiles/xenial-non-free/Dockerfile)
RUN set -x \
&& apt-get update \
&& { \
which gpg \
|| apt-get install -y --no-install-recommends gnupg \
; } \
&& { \
gpg --version | grep -q '^gpg (GnuPG) 1\.' \
|| apt-get install -y --no-install-recommends dirmngr \
; } \
&& rm -rf /var/lib/apt/lists/*
RUN set -x \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --keyserver ha.pool.sks-keyservers.net --recv-keys DD95CC430502E37EF840ACEEA5D32F012649A5A9 \
&& gpg --export DD95CC430502E37EF840ACEEA5D32F012649A5A9 > /etc/apt/trusted.gpg.d/neurodebian.gpg \
&& rm -rf "$GNUPGHOME" \
&& apt-key list | grep neurodebian
RUN { \
echo 'deb http://neuro.debian.net/debian xenial main'; \
echo 'deb http://neuro.debian.net/debian data main'; \
echo '#deb-src http://neuro.debian.net/debian-devel xenial main'; \
} > /etc/apt/sources.list.d/neurodebian.sources.list
RUN sed -i -e 's,main *$,main contrib non-free,g' /etc/apt/sources.list.d/neurodebian.sources.list; grep -q 'deb .* multiverse$' /etc/apt/sources.list || sed -i -e 's,universe *$,universe multiverse,g' /etc/apt/sources.list
############################
# Install dependencies
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y --force-yes \
xvfb \
xfonts-100dpi \
xfonts-75dpi \
xfonts-cyrillic \
zip \
unzip \
python \
imagemagick \
wget \
subversion \
fsl-5.0-core \
fsl-first-data \
jq \
ants
############################
# MRTRIX 3
# Here we download and build MRTRIX3 from source.
RUN apt-get install -y \
git \
g++ \
bsdtar \
python \
python-numpy \
libeigen3-dev \
zlib1g-dev \
libqt4-opengl-dev \
libgl1-mesa-dev \
libfftw3-dev \
libtiff5-dev
ENV mrtrix3COMMIT=8cef83213c4dcce7be1296849bda2b097004dd0c
RUN curl -#L https://github.com/MRtrix3/mrtrix3/archive/$mrtrix3COMMIT.zip | bsdtar -xf- -C /usr/lib
WORKDIR /usr/lib/
RUN mv mrtrix3-${mrtrix3COMMIT} mrtrix3
RUN chmod -R +rwx /usr/lib/mrtrix3
WORKDIR /usr/lib/mrtrix3
RUN ./configure && \
./build && \
./set_path
ENV PATH /usr/lib/mrtrix3/bin:$PATH
############################
# DTIINIT
# ADD the dtiInit Matlab Stand-Alone (MSA) into the container.
COPY dtiinit/source/bin/dtiInitStandAloneWrapper /usr/local/bin/dtiInit
# Add bet2 (FSL) to the container
ADD https://github.com/vistalab/vistasoft/raw/97aa8a8/mrAnatomy/Segment/bet2 /usr/local/bin/
# ADD AFQ and mrD templates via svn hackery
ENV TEMPLATES /templates
RUN mkdir $TEMPLATES
RUN svn export --force https://github.com/yeatmanlab/AFQ.git/trunk/templates/ $TEMPLATES
RUN svn export --force https://github.com/vistalab/vistasoft.git/trunk/mrDiffusion/templates/ $TEMPLATES
# Add the MNI_EPI template and JSON schema files to the container
ADD https://github.com/vistalab/vistasoft/raw/97aa8a8/mrDiffusion/templates/MNI_EPI.nii.gz $TEMPLATES
ADD https://github.com/vistalab/vistasoft/raw/97aa8a8/mrDiffusion/dtiInit/standalone/dtiInitStandAloneJsonSchema.json $TEMPLATES
# Copy the help text to display when no args are passed in.
COPY dtiinit/source/doc/help.txt /opt/help.txt
# Ensure that the executable files are executable
RUN chmod +x /usr/local/bin/bet2 /usr/local/bin/dtiInit
# Configure environment variables for bet2
ENV FSLOUTPUTTYPE NIFTI_GZ
# Copy and configure code
WORKDIR ${FLYWHEEL}
COPY dtiinit/source/run ${FLYWHEEL}/run_dtiinit
COPY dtiinit/source/parse_config.py ${FLYWHEEL}/dtiinit_parse_config.py
############################
# AFQ Browser
# It built the docker container but then it failed in the execution. Just removing it, never used.
# RUN apt-get update -qq \
# && apt-get install -y \
# git \
# python-dev \
# libblas-dev \
# liblapack-dev \
# libatlas-base-dev \
# gfortran \
# python-numpy \
# python-pandas \
# python-scipy \
# python-pip
# We need to start by upgrading setuptools, or run into https://github.com/yeatmanlab/AFQ-Browser/issues/101
# RUN pip install --upgrade setuptools
# Bust the cache to force the next steps:
# ENV BUSTCACHE 11
# Install AFQ-Browser from my branch:
# RUN pip install git+https://github.com/arokem/AFQ-Browser.git@zip
# Copy AFQ Browser run
# COPY afq-browser/run ${FLYWHEEL}/run_afq-browser.py
############################
# AFQ
# THIS IS IF WE ARE USING THE GIT LFS VERSION
# Install git-lfs
# RUN apt-get install -y software-properties-common && \
# add-apt-repository -y ppa:git-core/ppa && \
# curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
# apt-get install -y git-lfs && \
# git lfs install
# Download binary from git-lfs
# WORKDIR /tmp
# ENV COMMIT 9a8c9c9
# RUN git clone https://github.com/scitran-apps/afq-pipeline.git && \
# cd /tmp/afq-pipeline && \
# git reset ${COMMIT} && \
# git lfs pull && \
# cp /tmp/afq-pipeline/afq/source/bin/compiled/AFQ_StandAlone_QMR /usr/local/bin/AFQ
# AND THIS IF WE ARE COPYING THE BINARY FROM LOCAL
# ADD the source Code and Binary to the container
COPY afq/source/bin/compiled/RTP /usr/local/bin/AFQ
COPY afq/run ${FLYWHEEL}/run_afq
COPY afq/source/parse_config.py ${FLYWHEEL}/afq_parse_config.py
RUN chmod +x /usr/local/bin/AFQ ${FLYWHEEL}/afq_parse_config.py
# AND THIS WAS COMMON
# ADD the source Code and Binary to the container
COPY afq/run ${FLYWHEEL}/run_afq
COPY afq/source/parse_config.py ${FLYWHEEL}/afq_parse_config.py
RUN chmod +x /usr/local/bin/AFQ ${FLYWHEEL}/afq_parse_config.py
# Set the diplay env variable for xvfb
ENV DISPLAY :1.0
############################
# Configure entrypoint
COPY run ${FLYWHEEL}/run
RUN chmod +x ${FLYWHEEL}/*
ENTRYPOINT ["/flywheel/v0/run"]
COPY manifest.json ${FLYWHEEL}/manifest.json