From 0b5d1d1dd60df80334bd743477cde52359f0fa7f Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 16 Apr 2019 08:34:06 -0700 Subject: [PATCH 1/4] Edits in the Dockerfile, to depend on jupyter image, for jhub. --- docker/Dockerfile | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 06515d6..bf85502 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -7,7 +7,46 @@ # # https://github.com/kaczmarj/neurodocker -FROM debian:stretch +FROM jupyter/datascience-notebook:8d22c86ed4d7 + +# Neurodebian: + +USER root +# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg) +RUN set -x \ + && apt-get update \ + && { \ + which gpg \ + || apt-get install -y --no-install-recommends gnupg \ + ; } \ +# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr +# so, if we're not running gnupg 1.x, explicitly install dirmngr too + && { \ + gpg --version | grep -q '^gpg (GnuPG) 1\.' \ + || apt-get install -y --no-install-recommends dirmngr \ + ; } \ + && rm -rf /var/lib/apt/lists/* + +# apt-key is a bit finicky during "docker build" with gnupg 2.x, so install the repo key the same way debian-archive-keyring does (/etc/apt/trusted.gpg.d) +# this makes "apt-key list" output prettier too! +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 mkdir ~/.gnupg +RUN echo "disable-ipv6" >> ~/.gnupg/dirmngr.conf + +RUN { \ + echo 'deb http://neuro.debian.net/debian stretch main'; \ + echo 'deb http://neuro.debian.net/debian data main'; \ + echo '#deb-src http://neuro.debian.net/debian-devel stretch 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 /etc/apt/sources.list + ARG DEBIAN_FRONTEND="noninteractive" @@ -52,7 +91,6 @@ RUN apt-get update -qq \ libglu1-mesa-dev \ libgomp1 \ libice6 \ - libmng1 \ libxcursor1 \ libxft2 \ libxinerama1 \ From 0f9e35633e80367398cbee403900f9feda5d8c71 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 16 Apr 2019 14:39:22 -0700 Subject: [PATCH 2/4] Add the kernel installation into production image. --- Dockerfile-dmriprep | 3 ++- docker/Dockerfile | 47 ++++++++++++++++-------------------------- docker/environment.yml | 2 ++ 3 files changed, 22 insertions(+), 30 deletions(-) diff --git a/Dockerfile-dmriprep b/Dockerfile-dmriprep index 6343c37..57885e9 100644 --- a/Dockerfile-dmriprep +++ b/Dockerfile-dmriprep @@ -3,4 +3,5 @@ FROM dmriprep:dev ADD . /dmriprep WORKDIR /dmriprep RUN /neurodocker/startup.sh python setup.py install -WORKDIR / +RUN /neurodocker/startup.sh python -m ipykernel install --user --name dmriprep --display-name "Python (dmriprep)" +WORKDIR /home/jovyan/ diff --git a/docker/Dockerfile b/docker/Dockerfile index bf85502..487384d 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -78,6 +78,7 @@ RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \ ENTRYPOINT ["/neurodocker/startup.sh"] +# FSL ENV FSLDIR="/opt/fsl-5.0.11" \ PATH="/opt/fsl-5.0.11/bin:$PATH" RUN apt-get update -qq \ @@ -111,31 +112,7 @@ RUN apt-get update -qq \ && echo "Installing FSL conda environment ..." \ && bash /opt/fsl-5.0.11/etc/fslconf/fslpython_install.sh -f /opt/fsl-5.0.11 -ENV CONDA_DIR="/opt/miniconda-latest" \ - PATH="/opt/miniconda-latest/bin:$PATH" -RUN export PATH="/opt/miniconda-latest/bin:$PATH" \ - && echo "Downloading Miniconda installer ..." \ - && conda_installer="/tmp/miniconda.sh" \ - && curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ - && bash "$conda_installer" -b -p /opt/miniconda-latest \ - && rm -f "$conda_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 \ - && sync && conda clean -tipsy && sync -# && conda create -y -q --name dmriprep - -# RUN conda install -y -q --name dmriprep \ -# -c \ -# conda-forge \ -# python=3.6 \ -# nipype \ -# dipy \ -# boto3 \ -# && sync && conda clean -tipsy && sync - - +# FREESURFER ENV FREESURFER_HOME="/opt/freesurfer-6.0.0" \ PATH="/opt/freesurfer-6.0.0/bin:$PATH" @@ -170,17 +147,29 @@ RUN apt-get update -qq \ COPY ./license.txt /opt/freesurfer-6.0.0/license.txt -#&& sync && conda clean -tipsy && sync +# CONDA +ENV CONDA_DIR="/opt/miniconda-latest" \ + PATH="/opt/miniconda-latest/bin:$PATH" +RUN export PATH="/opt/miniconda-latest/bin:$PATH" \ + && echo "Downloading Miniconda installer ..." \ + && conda_installer="/tmp/miniconda.sh" \ + && curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ + && bash "$conda_installer" -b -p /opt/miniconda-latest \ + && rm -f "$conda_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 \ + && sync && conda clean -tipsy && sync RUN apt-get update && apt-get install -y git gcc libopenblas-base +ENV LD_LIBRARY_PATH=/usr/lib/openblas-base/ + ADD environment.yml environment.yml RUN conda env create -f environment.yml -ENV LD_LIBRARY_PATH=/usr/lib/openblas-base/ - RUN sed -i '$isource activate dmriprep' $ND_ENTRYPOINT - RUN echo '{ \ \n "pkg_manager": "apt", \ \n "instructions": [ \ diff --git a/docker/environment.yml b/docker/environment.yml index 30b45f5..d6cba66 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -10,6 +10,8 @@ dependencies: - ipython - pandas - tqdm + - pip + - ipykernel - pip: - "--editable=git+https://github.com/akeshavan/nipype@87e53615867c9850c359002909c71825343b2e35#egg=nipype" - "--editable=git+https://git.fmrib.ox.ac.uk/matteob/eddy_qc_release@57bb11da6a634c4195593fbc439ba9f8998157b0#egg=eddy_qc" From 38ad01cde0a2551ab308df54e0a5ee5019891474 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Tue, 16 Apr 2019 16:08:17 -0700 Subject: [PATCH 3/4] We also need the aws cli. --- docker/environment.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/environment.yml b/docker/environment.yml index d6cba66..79a7d05 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -17,3 +17,4 @@ dependencies: - "--editable=git+https://git.fmrib.ox.ac.uk/matteob/eddy_qc_release@57bb11da6a634c4195593fbc439ba9f8998157b0#egg=eddy_qc" - bids - duecredit + - awscli From 1130ebc26f737fff36bbaa37d6b6317a10fc9257 Mon Sep 17 00:00:00 2001 From: Ariel Rokem Date: Thu, 18 Apr 2019 13:06:56 -0700 Subject: [PATCH 4/4] Install using pip. --- Dockerfile-dmriprep | 1 + docker/Dockerfile | 2 ++ docker/environment.yml | 7 +------ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile-dmriprep b/Dockerfile-dmriprep index 57885e9..8b92c8d 100644 --- a/Dockerfile-dmriprep +++ b/Dockerfile-dmriprep @@ -4,4 +4,5 @@ ADD . /dmriprep WORKDIR /dmriprep RUN /neurodocker/startup.sh python setup.py install RUN /neurodocker/startup.sh python -m ipykernel install --user --name dmriprep --display-name "Python (dmriprep)" + WORKDIR /home/jovyan/ diff --git a/docker/Dockerfile b/docker/Dockerfile index 487384d..43dd669 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -167,6 +167,8 @@ ENV LD_LIBRARY_PATH=/usr/lib/openblas-base/ ADD environment.yml environment.yml RUN conda env create -f environment.yml +ADD requirements.txt requirements.txt +RUN pip install -r requirements.txt RUN sed -i '$isource activate dmriprep' $ND_ENTRYPOINT diff --git a/docker/environment.yml b/docker/environment.yml index 79a7d05..dabbb35 100644 --- a/docker/environment.yml +++ b/docker/environment.yml @@ -12,9 +12,4 @@ dependencies: - tqdm - pip - ipykernel - - pip: - - "--editable=git+https://github.com/akeshavan/nipype@87e53615867c9850c359002909c71825343b2e35#egg=nipype" - - "--editable=git+https://git.fmrib.ox.ac.uk/matteob/eddy_qc_release@57bb11da6a634c4195593fbc439ba9f8998157b0#egg=eddy_qc" - - bids - - duecredit - - awscli + - s3fs \ No newline at end of file