Skip to content

Commit ef9502c

Browse files
committed
ENH: reduces the docker image
1 parent 48bc7db commit ef9502c

File tree

2 files changed

+65
-62
lines changed

2 files changed

+65
-62
lines changed

Dockerfile

Lines changed: 53 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Generated by Neurodocker v0.2.0-15-g89db2ca.
22
#
3-
# Thank you for using Neurodocker. If you discover any issues
4-
# or ways to improve this software, please submit an issue or
3+
# Thank you for using Neurodocker. If you discover any issues
4+
# or ways to improve this software, please submit an issue or
55
# pull request on our GitHub repository:
66
# https://github.com/kaczmarj/neurodocker
77
#
8-
# Timestamp: 2017-09-01 15:15:46
8+
# Timestamp: 2017-09-03 11:54:59
99

1010
FROM neurodebian:stretch-non-free
1111

@@ -35,7 +35,8 @@ ENTRYPOINT ["/neurodocker/startup.sh"]
3535
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
3636

3737
RUN apt-get update -qq \
38-
&& apt-get install -y -q --no-install-recommends dcm2niix \
38+
&& apt-get install -y -q --no-install-recommends fsl \
39+
dcm2niix \
3940
convert3d \
4041
ants \
4142
graphviz \
@@ -59,13 +60,42 @@ RUN apt-get update -qq \
5960
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6061

6162
# User-defined instruction
62-
RUN apt-get update && apt-get install -yq xvfb mesa-utils libgl1-mesa-dri && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
63+
RUN apt-get update && apt-get install -yq xvfb mesa-utils libgl1-mesa-dri && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6364

64-
RUN apt-get update -qq \
65-
&& apt-get install -y -q --no-install-recommends afni \
66-
fsl \
65+
#--------------------
66+
# Install AFNI latest
67+
#--------------------
68+
ENV PATH=/opt/afni:$PATH
69+
RUN apt-get update -qq && apt-get install -yq --no-install-recommends ed gsl-bin libglu1-mesa-dev libglib2.0-0 libglw1-mesa \
70+
libgomp1 libjpeg62 libxm4 netpbm tcsh xfonts-base xvfb \
71+
&& libs_path=/usr/lib/x86_64-linux-gnu \
72+
&& if [ -f $libs_path/libgsl.so.19 ]; then \
73+
ln $libs_path/libgsl.so.19 $libs_path/libgsl.so.0; \
74+
fi \
75+
# Install libxp (not in all ubuntu/debian repositories) \
76+
&& apt-get install -yq --no-install-recommends libxp6 \
77+
|| /bin/bash -c " \
78+
curl --retry 5 -o /tmp/libxp6.deb -sSL http://mirrors.kernel.org/debian/pool/main/libx/libxp/libxp6_1.0.2-2_amd64.deb \
79+
&& dpkg -i /tmp/libxp6.deb && rm -f /tmp/libxp6.deb" \
80+
# Install libpng12 (not in all ubuntu/debian repositories) \
81+
&& apt-get install -yq --no-install-recommends libpng12-0 \
82+
|| /bin/bash -c " \
83+
curl -o /tmp/libpng12.deb -sSL http://mirrors.kernel.org/debian/pool/main/libp/libpng/libpng12-0_1.2.49-1%2Bdeb7u2_amd64.deb \
84+
&& dpkg -i /tmp/libpng12.deb && rm -f /tmp/libpng12.deb" \
85+
# Install R \
86+
&& apt-get install -yq --no-install-recommends \
87+
r-base-dev r-cran-rmpi \
88+
|| /bin/bash -c " \
89+
curl -o /tmp/install_R.sh -sSL https://gist.githubusercontent.com/kaczmarj/8e3792ae1af70b03788163c44f453b43/raw/0577c62e4771236adf0191c826a25249eb69a130/R_installer_debian_ubuntu.sh \
90+
&& /bin/bash /tmp/install_R.sh" \
6791
&& apt-get clean \
68-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
92+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
93+
&& echo "Downloading AFNI ..." \
94+
&& mkdir -p /opt/afni \
95+
&& curl -sSL --retry 5 https://afni.nimh.nih.gov/pub/dist/tgz/linux_openmp_64.tgz \
96+
| tar zx -C /opt/afni --strip-components=1 \
97+
&& /opt/afni/rPkgsInstall -pkgs ALL \
98+
&& rm -rf /tmp/*
6999

70100
#--------------------------
71101
# Install FreeSurfer v6.0.0
@@ -106,16 +136,7 @@ ENV MATLABCMD=/opt/mcr/v92/toolbox/matlab \
106136
LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/opt/mcr/v92/runtime/glnxa64:/opt/mcr/v92/bin/glnxa64:/opt/mcr/v92/sys/os/glnxa64:$LD_LIBRARY_PATH
107137

108138
# User-defined instruction
109-
RUN bash -c "curl -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb > libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb && dpkg -i libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb && rm libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb"
110-
111-
# User-defined instruction
112-
RUN bash -c "curl -sSL http://download2.rstudio.org/rstudio-server-$(curl https://s3.amazonaws.com/rstudio-server/current.ver)-amd64.deb >> rstudio-server-amd64.deb && dpkg -i rstudio-server-amd64.deb && rm rstudio-server-amd64.deb"
113-
114-
# User-defined instruction
115-
RUN Rscript -e 'install.packages(c("neuRosim", "ggplot2", "fmri", "dplyr", "tidyr", "Lahman", "data.table", "readr"), repos = "http://cran.case.edu")'
116-
117-
# User-defined instruction
118-
RUN curl -sSL https://dl.dropbox.com/s/lfuppfhuhi1li9t/cifti-data.tgz?dl=0 | tar zx -C /
139+
RUN curl -sSL https://dl.dropbox.com/s/lfuppfhuhi1li9t/cifti-data.tgz?dl=0 | tar zx -C /
119140

120141
# Create new user: neuro
121142
RUN useradd --no-user-group --create-home --shell /bin/bash neuro
@@ -141,41 +162,31 @@ RUN echo "Downloading Miniconda installer ..." \
141162
# Create conda environment
142163
#-------------------------
143164
RUN conda create -y -q --name neuro3 python=3.6 \
144-
jupyter jupyterlab traits pandas matplotlib scikit-learn seaborn swig reprozip reprounzip altair traitsui apptools configobj vtk jupyter_contrib_nbextensions bokeh scikit-image codecov nitime cython joblib jupyterhub=0.7.2 \
165+
jupyter jupyterlab traits pandas matplotlib scikit-learn seaborn swig reprozip reprounzip altair traitsui apptools configobj jupyter_contrib_nbextensions bokeh scikit-image codecov nitime cython joblib jupyterhub=0.7.2 \
145166
&& sync && conda clean -tipsy && sync \
146167
&& /bin/bash -c "source activate neuro3 \
147168
&& pip install -q --no-cache-dir \
148-
https://github.com/nipy/nibabel/archive/master.zip https://github.com/nipy/nipype/tarball/master nilearn https://github.com/INCF/pybids/archive/master.zip datalad dipy nipy duecredit pymvpa2 mayavi git+https://github.com/jupyterhub/nbserverproxy.git git+https://github.com/jupyterhub/nbrsessionproxy.git https://github.com/satra/mapalign/archive/master.zip pprocess " \
169+
https://github.com/nipy/nibabel/archive/master.zip https://github.com/nipy/nipype/tarball/master nilearn https://github.com/INCF/pybids/archive/master.zip datalad dipy nipy duecredit pymvpa2 git+https://github.com/jupyterhub/nbserverproxy.git git+https://github.com/jupyterhub/nbrsessionproxy.git https://github.com/satra/mapalign/archive/master.zip pprocess " \
149170
&& sync
150171
ENV PATH=/opt/conda/envs/neuro3/bin:$PATH
151172

152173
# User-defined instruction
153-
RUN bash -c "source activate neuro3 && python -m ipykernel install --sys-prefix --name neuro3 --display-name Py3-neuro "
154-
155-
# User-defined instruction
156-
RUN bash -c "source activate neuro3 && pip install --pre --upgrade ipywidgets pythreejs "
174+
RUN bash -c "source activate neuro3 && python -m ipykernel install --sys-prefix --name neuro3 --display-name Py3-neuro"
157175

158176
# User-defined instruction
159-
RUN bash -c "source activate neuro3 && pip install --upgrade https://github.com/maartenbreddels/ipyvolume/archive/master.zip && jupyter nbextension install --py --sys-prefix ipyvolume && jupyter nbextension enable --py --sys-prefix ipyvolume "
177+
RUN bash -c "source activate neuro3 && pip install --no-cache-dir --pre --upgrade ipywidgets pythreejs"
160178

161179
# User-defined instruction
162-
RUN bash -c "source activate neuro3 && jupyter nbextension enable rubberband/main && jupyter nbextension enable exercise2/main && jupyter nbextension enable spellchecker/main "
180+
RUN bash -c "source activate neuro3 && pip install --no-cache-dir --upgrade https://github.com/maartenbreddels/ipyvolume/archive/master.zip && jupyter nbextension install --py --sys-prefix ipyvolume && jupyter nbextension enable --py --sys-prefix ipyvolume"
163181

164182
# User-defined instruction
165-
RUN bash -c "source activate neuro3 && jupyter serverextension enable --sys-prefix --py nbserverproxy && jupyter serverextension enable --sys-prefix --py nbrsessionproxy && jupyter nbextension install --sys-prefix --py nbrsessionproxy && jupyter nbextension enable --sys-prefix --py nbrsessionproxy "
183+
RUN bash -c "source activate neuro3 && jupyter nbextension enable rubberband/main && jupyter nbextension enable exercise2/main && jupyter nbextension enable spellchecker/main"
166184

167185
# User-defined instruction
168-
RUN bash -c " source activate neuro3 && pip install git+https://github.com/data-8/gitautosync && jupyter serverextension enable --py nbgitautosync --sys-prefix "
169-
170-
#-------------------------
171-
# Create conda environment
172-
#-------------------------
173-
RUN conda create -y -q --name afni27 python=2.7 \
174-
ipykernel \
175-
&& sync && conda clean -tipsy && sync
186+
RUN bash -c "source activate neuro3 && jupyter serverextension enable --sys-prefix --py nbserverproxy && jupyter serverextension enable --sys-prefix --py nbrsessionproxy && jupyter nbextension install --sys-prefix --py nbrsessionproxy && jupyter nbextension enable --sys-prefix --py nbrsessionproxy"
176187

177188
# User-defined instruction
178-
RUN bash -c "source activate neuro3 && python -m ipykernel install --sys-prefix --name afni27 --display-name Py2-afni "
189+
RUN bash -c "source activate neuro3 && pip install --no-cache-dir git+https://github.com/data-8/gitautosync && jupyter serverextension enable --py nbgitautosync --sys-prefix"
179190

180191
USER root
181192

@@ -188,22 +199,22 @@ RUN echo 'neuro:neuro' | chpasswd && usermod -aG sudo neuro
188199
USER neuro
189200

190201
# User-defined instruction
191-
RUN bash -c "source activate neuro3 && cd /data && datalad install -r ///workshops/nih-2017/ds000114 && datalad get -r -J4 ds000114/sub-0[12]/ses-test/ && datalad get -r ds000114/derivatives/fr*/sub-0[12] && datalad get -r ds000114/derivatives/fm*/sub-0[12]/anat && datalad get -r ds000114/derivatives/fm*/sub-0[12]/ses-test && datalad get -r ds000114/derivatives/f*/fsaverage5 "
202+
RUN bash -c "source activate neuro3 && cd /data && datalad install -r ///workshops/nih-2017/ds000114 && datalad get -r -J8 ds000114/sub-0[12]/ses-test/anat && datalad get -r -J8 ds000114/sub-0[12]/ses-test/func/*fingerfootlips* && datalad get -r -J8 ds000114/derivatives/fmriprep/sub-0[12]/anat && datalad get -r -J8 ds000114/derivatives/fmriprep/sub-0[12]/ses-test/func/*fingerfootlips* && datalad get -r -J8 ds000114/derivatives/freesurfer/sub-0[12] && datalad get -r -J8 ds000114/derivatives/freesurfer/fsaverage5"
192203

193204
# User-defined instruction
194205
RUN curl -sSL https://osf.io/dhzv7/download?version=3 | tar zx -C /data/ds000114/derivatives/fmriprep
195206

196-
WORKDIR /home/neuro
207+
WORKDIR /repos
197208

198209
# User-defined instruction
199210
RUN cd /repos && git clone https://github.com/neuro-data-science/neuroviz.git && git clone https://github.com/neuro-data-science/neuroML.git && git clone https://github.com/ReproNim/reproducible-imaging.git && git clone https://github.com/miykael/nipype_tutorial.git && git clone https://github.com/jmumford/nhwEfficiency.git && git clone https://github.com/jmumford/R-tutorial.git
200211

201212
# User-defined instruction
202-
ENV PATH="${PATH}:/usr/lib/rstudio-server/bin"
213+
ENV PATH="${PATH}:/usr/lib/rstudio-server/bin"
203214

204215
# User-defined instruction
205-
ENV LD_LIBRARY_PATH="/usr/lib/R/lib:${LD_LIBRARY_PATH}"
216+
ENV LD_LIBRARY_PATH="/usr/lib/R/lib:${LD_LIBRARY_PATH}"
206217

207218
# User-defined instruction
208-
RUN bash -c "echo c.NotebookApp.ip = \'0.0.0.0\' > ~/.jupyter/jupyter_notebook_config.py"
219+
RUN bash -c "echo c.NotebookApp.ip = \'0.0.0.0\' > ~/.jupyter/jupyter_notebook_config.py"
209220

create_dockerfile.sh

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,31 @@
55

66
docker run --rm kaczmarj/neurodocker generate -b neurodebian:stretch-non-free -p apt \
77
--instruction "RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -" \
8-
--install dcm2niix convert3d ants graphviz tree git-annex-standalone vim emacs-nox nano less ncdu tig git-annex-remote-rclone build-essential nodejs r-recommended psmisc libapparmor1 sudo dc \
8+
--install fsl dcm2niix convert3d ants graphviz tree git-annex-standalone vim emacs-nox nano less ncdu tig git-annex-remote-rclone build-essential nodejs r-recommended psmisc libapparmor1 sudo dc \
99
--instruction "RUN apt-get update && apt-get install -yq xvfb mesa-utils libgl1-mesa-dri && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* " \
10-
--install afni fsl \
10+
--afni version=latest \
1111
--freesurfer version=6.0.0 min=True \
1212
--spm version=12 matlab_version=R2017a \
13-
--instruction "RUN bash -c \"curl -sSL http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb > libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb && dpkg -i libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb && rm libssl1.0.0_1.0.2g-1ubuntu11.2_amd64.deb\" " \
14-
--instruction "RUN bash -c \"curl -sSL http://download2.rstudio.org/rstudio-server-\$(curl https://s3.amazonaws.com/rstudio-server/current.ver)-amd64.deb >> rstudio-server-amd64.deb && dpkg -i rstudio-server-amd64.deb && rm rstudio-server-amd64.deb\" " \
15-
--instruction "RUN Rscript -e 'install.packages(c(\"neuRosim\", \"ggplot2\", \"fmri\", \"dplyr\", \"tidyr\", \"Lahman\", \"data.table\", \"readr\"), repos = \"http://cran.case.edu\")' " \
1613
--instruction "RUN curl -sSL https://dl.dropbox.com/s/lfuppfhuhi1li9t/cifti-data.tgz?dl=0 | tar zx -C / " \
1714
--user=neuro \
1815
--miniconda python_version=3.6 \
19-
conda_install="jupyter jupyterlab traits pandas matplotlib scikit-learn seaborn swig reprozip reprounzip altair traitsui apptools configobj vtk jupyter_contrib_nbextensions bokeh scikit-image codecov nitime cython joblib jupyterhub=0.7.2" \
16+
conda_install="jupyter jupyterlab traits pandas matplotlib scikit-learn seaborn swig reprozip reprounzip altair traitsui apptools configobj jupyter_contrib_nbextensions bokeh scikit-image codecov nitime cython joblib jupyterhub=0.7.2" \
2017
env_name="neuro3" \
2118
add_to_path=True \
22-
pip_install="https://github.com/nipy/nibabel/archive/master.zip https://github.com/nipy/nipype/tarball/master nilearn https://github.com/INCF/pybids/archive/master.zip datalad dipy nipy duecredit pymvpa2 mayavi git+https://github.com/jupyterhub/nbserverproxy.git git+https://github.com/jupyterhub/nbrsessionproxy.git https://github.com/satra/mapalign/archive/master.zip pprocess " \
23-
--instruction "RUN bash -c \"source activate neuro3 && python -m ipykernel install --sys-prefix --name neuro3 --display-name Py3-neuro \" " \
24-
--instruction "RUN bash -c \"source activate neuro3 && pip install --pre --upgrade ipywidgets pythreejs \" " \
25-
--instruction "RUN bash -c \"source activate neuro3 && pip install --upgrade https://github.com/maartenbreddels/ipyvolume/archive/master.zip && jupyter nbextension install --py --sys-prefix ipyvolume && jupyter nbextension enable --py --sys-prefix ipyvolume \" " \
26-
--instruction "RUN bash -c \"source activate neuro3 && jupyter nbextension enable rubberband/main && jupyter nbextension enable exercise2/main && jupyter nbextension enable spellchecker/main \" " \
27-
--instruction "RUN bash -c \"source activate neuro3 && jupyter serverextension enable --sys-prefix --py nbserverproxy && jupyter serverextension enable --sys-prefix --py nbrsessionproxy && jupyter nbextension install --sys-prefix --py nbrsessionproxy && jupyter nbextension enable --sys-prefix --py nbrsessionproxy \" " \
28-
--instruction "RUN bash -c \" source activate neuro3 && pip install git+https://github.com/data-8/gitautosync && jupyter serverextension enable --py nbgitautosync --sys-prefix \" " \
29-
--miniconda python_version=2.7 \
30-
env_name="afni27" \
31-
conda_install="ipykernel" \
32-
add_to_path=False \
33-
--instruction "RUN bash -c \"source activate neuro3 && python -m ipykernel install --sys-prefix --name afni27 --display-name Py2-afni \" " \
19+
pip_install="https://github.com/nipy/nibabel/archive/master.zip https://github.com/nipy/nipype/tarball/master nilearn https://github.com/INCF/pybids/archive/master.zip datalad dipy nipy duecredit pymvpa2 git+https://github.com/jupyterhub/nbserverproxy.git git+https://github.com/jupyterhub/nbrsessionproxy.git https://github.com/satra/mapalign/archive/master.zip pprocess " \
20+
--instruction "RUN bash -c \"source activate neuro3 && python -m ipykernel install --sys-prefix --name neuro3 --display-name Py3-neuro\" " \
21+
--instruction "RUN bash -c \"source activate neuro3 && pip install --no-cache-dir --pre --upgrade ipywidgets pythreejs\" " \
22+
--instruction "RUN bash -c \"source activate neuro3 && pip install --no-cache-dir --upgrade https://github.com/maartenbreddels/ipyvolume/archive/master.zip && jupyter nbextension install --py --sys-prefix ipyvolume && jupyter nbextension enable --py --sys-prefix ipyvolume\" " \
23+
--instruction "RUN bash -c \"source activate neuro3 && jupyter nbextension enable rubberband/main && jupyter nbextension enable exercise2/main && jupyter nbextension enable spellchecker/main\" " \
24+
--instruction "RUN bash -c \"source activate neuro3 && jupyter serverextension enable --sys-prefix --py nbserverproxy && jupyter serverextension enable --sys-prefix --py nbrsessionproxy && jupyter nbextension install --sys-prefix --py nbrsessionproxy && jupyter nbextension enable --sys-prefix --py nbrsessionproxy\" " \
25+
--instruction "RUN bash -c \"source activate neuro3 && pip install --no-cache-dir git+https://github.com/data-8/gitautosync && jupyter serverextension enable --py nbgitautosync --sys-prefix\" " \
3426
--user=root \
3527
--instruction "RUN mkdir /data && chown neuro /data && chmod 777 /data && mkdir /output && chown neuro /output && chmod 777 /output && mkdir /repos && chown neuro /repos && chmod 777 /repos" \
3628
--instruction "RUN echo 'neuro:neuro' | chpasswd && usermod -aG sudo neuro" \
3729
--user=neuro \
38-
--instruction "RUN bash -c \"source activate neuro3 && cd /data && datalad install -r ///workshops/nih-2017/ds000114 && datalad get -r -J4 ds000114/sub-0[12]/ses-test/ && datalad get -r ds000114/derivatives/fr*/sub-0[12] && datalad get -r ds000114/derivatives/fm*/sub-0[12]/anat && datalad get -r ds000114/derivatives/fm*/sub-0[12]/ses-test && datalad get -r ds000114/derivatives/f*/fsaverage5 \" " \
30+
--instruction "RUN bash -c \"source activate neuro3 && cd /data && datalad install -r ///workshops/nih-2017/ds000114 && datalad get -r -J8 ds000114/sub-0[12]/ses-test/anat && datalad get -r -J8 ds000114/sub-0[12]/ses-test/func/*fingerfootlips* && datalad get -r -J8 ds000114/derivatives/fmriprep/sub-0[12]/anat && datalad get -r -J8 ds000114/derivatives/fmriprep/sub-0[12]/ses-test/func/*fingerfootlips* && datalad get -r -J8 ds000114/derivatives/freesurfer/sub-0[12] && datalad get -r -J8 ds000114/derivatives/freesurfer/fsaverage5\" " \
3931
--instruction "RUN curl -sSL https://osf.io/dhzv7/download?version=3 | tar zx -C /data/ds000114/derivatives/fmriprep" \
40-
--workdir /home/neuro \
32+
--workdir /repos \
4133
--instruction "RUN cd /repos && git clone https://github.com/neuro-data-science/neuroviz.git && git clone https://github.com/neuro-data-science/neuroML.git && git clone https://github.com/ReproNim/reproducible-imaging.git && git clone https://github.com/miykael/nipype_tutorial.git && git clone https://github.com/jmumford/nhwEfficiency.git && git clone https://github.com/jmumford/R-tutorial.git" \
4234
--instruction "ENV PATH=\"\${PATH}:/usr/lib/rstudio-server/bin\" " \
4335
--instruction "ENV LD_LIBRARY_PATH=\"/usr/lib/R/lib:\${LD_LIBRARY_PATH}\" " \

0 commit comments

Comments
 (0)