-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dockerfile
192 lines (161 loc) · 5.94 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
# Generated by Neurodocker v0.3.2.
#
# Thank you for using Neurodocker. If you discover any issues
# or ways to improve this software, please submit an issue or
# pull request on our GitHub repository:
# https://github.com/kaczmarj/neurodocker
#
# Timestamp: 2018-02-02 16:32:55
FROM debian:stretch
ARG DEBIAN_FRONTEND=noninteractive
#----------------------------------------------------------
# Install common dependencies and create default entrypoint
#----------------------------------------------------------
# replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
ENV LANG="en_US.UTF-8" \
LC_ALL="C.UTF-8" \
ND_ENTRYPOINT="/neurodocker/startup.sh"
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
apt-utils \
bzip2 \
ca-certificates \
cmake \
curl \
dirmngr \
g++ \
gcc \
git \
gnupg \
locales \
make \
nano \
pigz \
unzip \
zlib1g-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
&& localedef --force --inputfile=en_US --charmap=UTF-8 C.UTF-8 \
&& chmod 777 /opt && chmod a+s /opt \
&& mkdir -p /neurodocker \
&& if [ ! -f "$ND_ENTRYPOINT" ]; then \
echo '#!/usr/bin/env bash' >> $ND_ENTRYPOINT \
&& echo 'set +x' >> $ND_ENTRYPOINT \
&& echo 'if [ -z "$*" ]; then /usr/bin/env bash; else $*; fi' >> $ND_ENTRYPOINT; \
fi \
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker
#-------------------------------
# Install dcm2niix v1.0.20200331
#-------------------------------
RUN mkdir -p /src/dcm2niix \
&& curl -sSL https://github.com/rordenlab/dcm2niix/tarball/v1.0.20200331 | tar xz -C /src/dcm2niix --strip-components 1 \
&& mkdir /src/dcm2niix/build && cd /src/dcm2niix/build \
&& cmake .. && make \
&& make install
#--------------------------------------------------
# Add NeuroDebian repository
# Please note that some packages downloaded through
# NeuroDebian may have restrictive licenses.
#--------------------------------------------------
RUN curl -sSL http://neuro.debian.net/lists/stretch.us-nh.full \
> /etc/apt/sources.list.d/neurodebian.sources.list \
&& curl -sSL https://dl.dropbox.com/s/zxs209o955q6vkg/neurodebian.gpg \
| apt-key add - \
&& (apt-key adv --refresh-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 || true) \
&& apt-get update
#----------------------------------
# Install Datalad (via NeuroDebian)
#----------------------------------
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
datalad \
git-annex-standalone \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
#--------------------
# Download mri_deface
#--------------------
# Download mri_deface nd additional files from MGH
USER root
ENV DEFACE_DIR /src/deface
RUN mkdir -p $DEFACE_DIR
RUN curl -sSL -o $DEFACE_DIR/mri_deface \
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/mri_deface/mri_deface_linux && \
chmod +x $DEFACE_DIR/mri_deface
RUN curl -sSL -o $DEFACE_DIR/face.gca.gz \
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/mri_deface/face.gca.gz && \
gunzip $DEFACE_DIR/face.gca.gz
RUN curl -sSL -o $DEFACE_DIR/talairach_mixed_with_skull.gca.gz \
ftp://surfer.nmr.mgh.harvard.edu/pub/dist/mri_deface/talairach_mixed_with_skull.gca.gz && \
gunzip $DEFACE_DIR/talairach_mixed_with_skull.gca.gz
ENV PATH=$PATH:$DEFACE_DIR
#---------------
# BIDS-validator
#---------------
#Install nvm
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 10.16.3
# https://github.com/creationix/nvm#install-script
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.2/install.sh | bash
# install node and npm
RUN source $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default
# add node and npm to path so the commands are available
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH
RUN npm install -g [email protected]
#---------------------
# Create neuro account
#---------------------
RUN useradd --no-user-group --create-home --shell /bin/bash neuro
USER neuro
WORKDIR /home/neuro
#------------------
# Install Miniconda
#------------------
ENV CONDA_DIR=/opt/conda \
PATH=/opt/conda/bin:$PATH
RUN echo "Downloading Miniconda installer ..." \
&& miniconda_installer=/tmp/miniconda.sh \
&& curl -sSL --retry 5 -o $miniconda_installer https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& /bin/bash $miniconda_installer -b -p $CONDA_DIR \
&& rm -f $miniconda_installer \
&& conda update -yq -nbase conda \
&& conda config --system --prepend channels conda-forge \
&& conda config --system --set auto_update_conda false \
&& conda config --system --set show_channel_urls true \
&& conda clean -tipsy && sync
#-------------------------
# Create conda environment
#-------------------------
COPY [".", "/src/bidsify"]
USER root
RUN chmod 755 -R /src/
RUN conda create -y -q --name neuro python=3.7 \
&& sync && conda clean --all && sync \
&& /bin/bash -c "source activate neuro \
&& pip install /src/bidsify/"\
&& sync \
&& sed -i '$isource activate neuro' $ND_ENTRYPOINT
USER root
RUN mkdir /work && chown -R neuro /src /work
USER neuro
RUN bash -c "source activate neuro \
&& pip install --no-cache-dir /src/bidsify/" \
&& rm -rf ~/.cache/pip/* \
&& sync
#----------------------
# Set entrypoint script
#----------------------
ENTRYPOINT ["/neurodocker/startup.sh", "bidsify"]
#--------------------------------------------
# Set environmental variables for Singularity
#--------------------------------------------
ENV SINGULARITY_CACHEDIR /scratch
ENV SINGULARITY_TMPDIR /scratch
#-------------------------------
# Set user and working directory
#-------------------------------
USER neuro
WORKDIR /work