Skip to content

Commit e4a5551

Browse files
authored
Merge pull request #268 from mgxd/fix/dckr
maint: docker build
2 parents 73507f3 + ce62675 commit e4a5551

File tree

2 files changed

+89
-99
lines changed

2 files changed

+89
-99
lines changed

Dockerfile

Lines changed: 84 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,142 +1,130 @@
1-
# Generated by Neurodocker v0.3.2.
2-
#
1+
# Generated by Neurodocker version 0.4.1
2+
# Timestamp: 2018-11-01 18:20:45 UTC
3+
#
34
# Thank you for using Neurodocker. If you discover any issues
45
# or ways to improve this software, please submit an issue or
56
# pull request on our GitHub repository:
7+
#
68
# https://github.com/kaczmarj/neurodocker
7-
#
8-
# Timestamp: 2018-06-29 18:14:08
99

10-
FROM debian:stretch
10+
FROM neurodebian:stretch
1111

12-
ARG DEBIAN_FRONTEND=noninteractive
12+
ARG DEBIAN_FRONTEND="noninteractive"
1313

14-
#----------------------------------------------------------
15-
# Install common dependencies and create default entrypoint
16-
#----------------------------------------------------------
1714
ENV LANG="en_US.UTF-8" \
18-
LC_ALL="C.UTF-8" \
15+
LC_ALL="en_US.UTF-8" \
1916
ND_ENTRYPOINT="/neurodocker/startup.sh"
20-
RUN apt-get update -qq && apt-get install -yq --no-install-recommends \
21-
apt-utils bzip2 ca-certificates curl locales unzip \
17+
RUN export ND_ENTRYPOINT="/neurodocker/startup.sh" \
18+
&& apt-get update -qq \
19+
&& apt-get install -y -q --no-install-recommends \
20+
apt-utils \
21+
bzip2 \
22+
ca-certificates \
23+
curl \
24+
locales \
25+
unzip \
2226
&& apt-get clean \
2327
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
24-
&& localedef --force --inputfile=en_US --charmap=UTF-8 C.UTF-8 \
28+
&& sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \
29+
&& dpkg-reconfigure --frontend=noninteractive locales \
30+
&& update-locale LANG="en_US.UTF-8" \
2531
&& chmod 777 /opt && chmod a+s /opt \
2632
&& mkdir -p /neurodocker \
2733
&& if [ ! -f "$ND_ENTRYPOINT" ]; then \
28-
echo '#!/usr/bin/env bash' >> $ND_ENTRYPOINT \
29-
&& echo 'set +x' >> $ND_ENTRYPOINT \
30-
&& echo 'if [ -z "$*" ]; then /usr/bin/env bash; else $*; fi' >> $ND_ENTRYPOINT; \
31-
fi \
34+
echo '#!/usr/bin/env bash' >> "$ND_ENTRYPOINT" \
35+
&& echo 'set -e' >> "$ND_ENTRYPOINT" \
36+
&& echo 'if [ -n "$1" ]; then "$@"; else /usr/bin/env bash; fi' >> "$ND_ENTRYPOINT"; \
37+
fi \
3238
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker
39+
3340
ENTRYPOINT ["/neurodocker/startup.sh"]
3441

35-
#------------------------
36-
# Install dcm2niix v1.0.20180622
37-
#------------------------
38-
WORKDIR /tmp
39-
RUN deps='cmake g++ gcc git make pigz zlib1g-dev' \
40-
&& apt-get update -qq && apt-get install -yq --no-install-recommends $deps \
42+
ENV PATH="/opt/dcm2niix-v1.0.20180622/bin:$PATH"
43+
RUN apt-get update -qq \
44+
&& apt-get install -y -q --no-install-recommends \
45+
cmake \
46+
g++ \
47+
gcc \
48+
git \
49+
make \
50+
pigz \
51+
zlib1g-dev \
4152
&& apt-get clean \
4253
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
43-
&& mkdir dcm2niix \
44-
&& curl -sSL https://github.com/rordenlab/dcm2niix/tarball/v1.0.20180622 | tar xz -C dcm2niix --strip-components 1 \
45-
&& mkdir dcm2niix/build && cd dcm2niix/build \
46-
&& cmake .. && make \
54+
&& git clone https://github.com/rordenlab/dcm2niix /tmp/dcm2niix \
55+
&& cd /tmp/dcm2niix \
56+
&& git fetch --tags \
57+
&& git checkout v1.0.20180622 \
58+
&& mkdir /tmp/dcm2niix/build \
59+
&& cd /tmp/dcm2niix/build \
60+
&& cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dcm2niix-v1.0.20180622 .. \
61+
&& make \
4762
&& make install \
48-
&& rm -rf /tmp/* \
49-
&& apt-get purge -y --auto-remove $deps
50-
51-
#--------------------------------------------------
52-
# Add NeuroDebian repository
53-
# Please note that some packages downloaded through
54-
# NeuroDebian may have restrictive licenses.
55-
#--------------------------------------------------
56-
RUN apt-get update -qq && apt-get install -yq --no-install-recommends dirmngr gnupg \
57-
&& apt-get clean \
58-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
59-
&& curl -sSL http://neuro.debian.net/lists/stretch.us-nh.full \
60-
> /etc/apt/sources.list.d/neurodebian.sources.list \
61-
&& curl -sSL https://dl.dropbox.com/s/zxs209o955q6vkg/neurodebian.gpg \
62-
| apt-key add - \
63-
&& (apt-key adv --refresh-keys --keyserver hkp://pool.sks-keyservers.net:80 0xA5D32F012649A5A9 || true) \
64-
&& apt-get update
65-
66-
# Install NeuroDebian packages
67-
RUN apt-get update -qq && apt-get install -yq --no-install-recommends git-annex-standalone \
68-
&& apt-get clean \
69-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
63+
&& rm -rf /tmp/dcm2niix
7064

7165
RUN apt-get update -qq \
72-
&& apt-get install -y -q --no-install-recommends git \
73-
gcc \
74-
pigz \
66+
&& apt-get install -y -q --no-install-recommends \
67+
git \
68+
gcc \
69+
pigz \
70+
liblzma-dev \
71+
libc-dev \
72+
git-annex-standalone \
7573
&& apt-get clean \
7674
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
7775

7876
COPY [".", "/src/heudiconv"]
7977

80-
#------------------
81-
# Install Miniconda
82-
#------------------
83-
ENV CONDA_DIR=/opt/conda \
84-
PATH=/opt/conda/bin:$PATH
85-
RUN echo "Downloading Miniconda installer ..." \
86-
&& miniconda_installer=/tmp/miniconda.sh \
87-
&& curl -sSL --retry 5 -o $miniconda_installer https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
88-
&& /bin/bash $miniconda_installer -b -p $CONDA_DIR \
89-
&& rm -f $miniconda_installer \
78+
ENV CONDA_DIR="/opt/miniconda-latest" \
79+
PATH="/opt/miniconda-latest/bin:$PATH"
80+
RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
81+
&& echo "Downloading Miniconda installer ..." \
82+
&& conda_installer="/tmp/miniconda.sh" \
83+
&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
84+
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
85+
&& rm -f "$conda_installer" \
86+
&& conda update -yq -nbase conda \
9087
&& conda config --system --prepend channels conda-forge \
9188
&& conda config --system --set auto_update_conda false \
9289
&& conda config --system --set show_channel_urls true \
93-
&& conda clean -tipsy && sync
94-
95-
#-------------------------
96-
# Create conda environment
97-
#-------------------------
98-
RUN conda create -y -q --name neuro python=2 \
99-
traits=4.6.0 \
10090
&& sync && conda clean -tipsy && sync \
101-
&& /bin/bash -c "source activate neuro \
102-
&& pip install -q --no-cache-dir https://github.com/moloney/dcmstack/tarball/master \
103-
/src/heudiconv[all]" \
91+
&& conda create -y -q --name neuro \
92+
&& conda install -y -q --name neuro \
93+
python=3.6 \
94+
traits>=4.6.0 \
95+
&& sync && conda clean -tipsy && sync \
96+
&& bash -c "source activate neuro \
97+
&& pip install --no-cache-dir \
98+
/src/heudiconv[all]" \
99+
&& rm -rf ~/.cache/pip/* \
104100
&& sync \
105101
&& sed -i '$isource activate neuro' $ND_ENTRYPOINT
106102

107103
ENTRYPOINT ["/neurodocker/startup.sh", "heudiconv"]
108104

109-
#--------------------------------------
110-
# Save container specifications to JSON
111-
#--------------------------------------
112105
RUN echo '{ \
113106
\n "pkg_manager": "apt", \
114-
\n "check_urls": true, \
115107
\n "instructions": [ \
116108
\n [ \
117109
\n "base", \
118-
\n "debian:stretch" \
110+
\n "neurodebian:stretch" \
119111
\n ], \
120112
\n [ \
121113
\n "dcm2niix", \
122114
\n { \
123-
\n "version": "v1.0.20180622" \
124-
\n } \
125-
\n ], \
126-
\n [ \
127-
\n "neurodebian", \
128-
\n { \
129-
\n "os_codename": "stretch", \
130-
\n "download_server": "usa-nh", \
131-
\n "pkgs": "git-annex-standalone" \
115+
\n "version": "v1.0.20180622", \
116+
\n "method": "source" \
132117
\n } \
133118
\n ], \
134119
\n [ \
135120
\n "install", \
136121
\n [ \
137122
\n "git", \
138123
\n "gcc", \
139-
\n "pigz" \
124+
\n "pigz", \
125+
\n "liblzma-dev", \
126+
\n "libc-dev", \
127+
\n "git-annex-standalone" \
140128
\n ] \
141129
\n ], \
142130
\n [ \
@@ -149,17 +137,20 @@ RUN echo '{ \
149137
\n [ \
150138
\n "miniconda", \
151139
\n { \
152-
\n "env_name": "neuro", \
153-
\n "conda_install": "python=2 traits=4.6.0", \
140+
\n "create_env": "neuro", \
141+
\n "conda_install": [ \
142+
\n "python=3.6", \
143+
\n "traits>=4.6.0" \
144+
\n ], \
154145
\n "activate": true, \
155-
\n "pip_install": "https://github.com/moloney/dcmstack/tarball/master /src/heudiconv[all]" \
146+
\n "pip_install": [ \
147+
\n "/src/heudiconv[all]" \
148+
\n ] \
156149
\n } \
157150
\n ], \
158151
\n [ \
159152
\n "entrypoint", \
160153
\n "/neurodocker/startup.sh heudiconv" \
161154
\n ] \
162-
\n ], \
163-
\n "generation_timestamp": "2018-06-29 18:14:08", \
164-
\n "neurodocker_version": "0.3.2" \
155+
\n ] \
165156
\n}' > /neurodocker/neurodocker_specs.json

utils/gen-docker-image.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ set -eu
44

55
VER=$(grep -Po '(?<=^__version__ = ).*' ../heudiconv/info.py | sed 's/"//g')
66

7-
docker run --rm kaczmarj/neurodocker:v0.3.2 generate -b debian:stretch -p apt \
8-
--dcm2niix version=v1.0.20180622 \
9-
--neurodebian os_codename=stretch download_server=usa-nh pkgs=git-annex-standalone \
10-
--install git gcc pigz \
7+
docker run --rm kaczmarj/neurodocker:0.4.1 generate docker -b neurodebian:stretch -p apt \
8+
--dcm2niix version=v1.0.20180622 method=source \
9+
--install git gcc pigz liblzma-dev libc-dev git-annex-standalone \
1110
--copy . /src/heudiconv \
12-
--miniconda env_name=neuro conda_install="python=2 traits=4.6.0" activate=True \
13-
pip_install="https://github.com/moloney/dcmstack/tarball/master /src/heudiconv[all]" \
11+
--miniconda create_env=neuro conda_install="python=3.6 traits>=4.6.0" activate=True \
12+
pip_install="/src/heudiconv[all]" \
1413
--entrypoint "/neurodocker/startup.sh heudiconv" \
1514
> ../Dockerfile

0 commit comments

Comments
 (0)