Skip to content

Commit 4a4dc85

Browse files
committed
Fixup miniconda spec for neurodocker so it produces dockerfile now
1 parent 7effb64 commit 4a4dc85

File tree

2 files changed

+125
-130
lines changed

2 files changed

+125
-130
lines changed

Dockerfile

Lines changed: 124 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -1,164 +1,159 @@
1-
# Generated by Neurodocker version 0.4.2-3-gf7055a1
2-
# Timestamp: 2022-04-06 17:10:29 UTC
3-
#
4-
# Thank you for using Neurodocker. If you discover any issues
5-
# or ways to improve this software, please submit an issue or
6-
# pull request on our GitHub repository:
7-
#
8-
# https://github.com/kaczmarj/neurodocker
1+
# Generated by Neurodocker and Reproenv.
92

103
FROM neurodebian:bullseye
11-
12-
ARG DEBIAN_FRONTEND="noninteractive"
13-
14-
ENV LANG="en_US.UTF-8" \
15-
LC_ALL="en_US.UTF-8" \
16-
ND_ENTRYPOINT="/neurodocker/startup.sh"
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 \
26-
&& apt-get clean \
27-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
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" \
31-
&& chmod 777 /opt && chmod a+s /opt \
32-
&& mkdir -p /neurodocker \
33-
&& if [ ! -f "$ND_ENTRYPOINT" ]; then \
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 \
38-
&& chmod -R 777 /neurodocker && chmod a+s /neurodocker
39-
40-
ENTRYPOINT ["/neurodocker/startup.sh"]
41-
424
ENV PATH="/opt/dcm2niix-v1.0.20211006/bin:$PATH"
435
RUN apt-get update -qq \
446
&& apt-get install -y -q --no-install-recommends \
7+
ca-certificates \
458
cmake \
469
g++ \
4710
gcc \
4811
git \
4912
make \
5013
pigz \
5114
zlib1g-dev \
52-
&& apt-get clean \
53-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
15+
&& rm -rf /var/lib/apt/lists/* \
5416
&& git clone https://github.com/rordenlab/dcm2niix /tmp/dcm2niix \
5517
&& cd /tmp/dcm2niix \
5618
&& git fetch --tags \
5719
&& git checkout v1.0.20211006 \
5820
&& mkdir /tmp/dcm2niix/build \
5921
&& cd /tmp/dcm2niix/build \
6022
&& cmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dcm2niix-v1.0.20211006 .. \
61-
&& make \
23+
&& make -j1 \
6224
&& make install \
6325
&& rm -rf /tmp/dcm2niix
64-
6526
RUN apt-get update -qq \
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 \
73-
netbase \
74-
&& apt-get clean \
75-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
76-
77-
COPY [".", "/src/heudiconv"]
78-
27+
&& apt-get install -y -q --no-install-recommends \
28+
gcc \
29+
git \
30+
git-annex-standalone \
31+
libc-dev \
32+
liblzma-dev \
33+
netbase \
34+
pigz \
35+
&& rm -rf /var/lib/apt/lists/*
36+
COPY [".", \
37+
"/src/heudiconv"]
7938
ENV CONDA_DIR="/opt/miniconda-latest" \
8039
PATH="/opt/miniconda-latest/bin:$PATH"
81-
RUN export PATH="/opt/miniconda-latest/bin:$PATH" \
40+
RUN apt-get update -qq \
41+
&& apt-get install -y -q --no-install-recommends \
42+
bzip2 \
43+
ca-certificates \
44+
curl \
45+
&& rm -rf /var/lib/apt/lists/* \
46+
# Install dependencies.
47+
&& export PATH="/opt/miniconda-latest/bin:$PATH" \
8248
&& echo "Downloading Miniconda installer ..." \
8349
&& conda_installer="/tmp/miniconda.sh" \
84-
&& curl -fsSL --retry 5 -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
50+
&& curl -fsSL -o "$conda_installer" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \
8551
&& bash "$conda_installer" -b -p /opt/miniconda-latest \
8652
&& rm -f "$conda_installer" \
8753
&& conda update -yq -nbase conda \
54+
# Prefer packages in conda-forge
8855
&& conda config --system --prepend channels conda-forge \
56+
# Packages in lower-priority channels not considered if a package with the same
57+
# name exists in a higher priority channel. Can dramatically speed up installations.
58+
# Conda recommends this as a default
59+
# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html
60+
&& conda config --set channel_priority strict \
8961
&& conda config --system --set auto_update_conda false \
9062
&& conda config --system --set show_channel_urls true \
91-
&& sync && conda clean -y --all && sync \
92-
&& conda install -y -q --name base \
93-
'python=3.7' \
94-
'traits>=4.6.0' \
95-
'scipy' \
96-
'numpy' \
97-
'nomkl' \
98-
'pandas' \
99-
&& sync && conda clean -y --all && sync \
63+
# Enable `conda activate`
64+
&& conda init bash \
65+
&& conda install -y --name base \
66+
"python=3.7" \
67+
"traits>=4.6.0" \
68+
"scipy" \
69+
"numpy" \
70+
"nomkl" \
71+
"pandas" \
10072
&& bash -c "source activate base \
101-
&& pip install --no-cache-dir --editable \
102-
'/src/heudiconv[all]'" \
103-
&& rm -rf ~/.cache/pip/* \
104-
&& sync
105-
73+
&& python -m pip install --no-cache-dir --editable \
74+
"/src/heudiconv[all]"" \
75+
# Clean up
76+
&& sync && conda clean --all --yes && sync \
77+
&& rm -rf ~/.cache/pip/*
10678
ENTRYPOINT ["heudiconv"]
10779

108-
RUN echo '{ \
109-
\n "pkg_manager": "apt", \
110-
\n "instructions": [ \
111-
\n [ \
112-
\n "base", \
113-
\n "neurodebian:bullseye" \
114-
\n ], \
115-
\n [ \
116-
\n "dcm2niix", \
117-
\n { \
118-
\n "version": "v1.0.20211006", \
119-
\n "method": "source" \
120-
\n } \
121-
\n ], \
122-
\n [ \
123-
\n "install", \
124-
\n [ \
125-
\n "git", \
126-
\n "gcc", \
127-
\n "pigz", \
128-
\n "liblzma-dev", \
129-
\n "libc-dev", \
130-
\n "git-annex-standalone", \
131-
\n "netbase" \
132-
\n ] \
133-
\n ], \
134-
\n [ \
135-
\n "copy", \
136-
\n [ \
137-
\n ".", \
138-
\n "/src/heudiconv" \
139-
\n ] \
140-
\n ], \
141-
\n [ \
142-
\n "miniconda", \
143-
\n { \
144-
\n "use_env": "base", \
145-
\n "conda_install": [ \
146-
\n "python=3.7", \
147-
\n "traits>=4.6.0", \
148-
\n "scipy", \
149-
\n "numpy", \
150-
\n "nomkl", \
151-
\n "pandas" \
152-
\n ], \
153-
\n "pip_install": [ \
154-
\n "/src/heudiconv[all]" \
155-
\n ], \
156-
\n "pip_opts": "--editable" \
157-
\n } \
158-
\n ], \
159-
\n [ \
160-
\n "entrypoint", \
161-
\n "heudiconv" \
162-
\n ] \
163-
\n ] \
164-
\n}' > /neurodocker/neurodocker_specs.json
80+
# Save specification to JSON.
81+
RUN printf '{ \
82+
"pkg_manager": "apt", \
83+
"existing_users": [ \
84+
"root" \
85+
], \
86+
"instructions": [ \
87+
{ \
88+
"name": "from_", \
89+
"kwds": { \
90+
"base_image": "neurodebian:bullseye" \
91+
} \
92+
}, \
93+
{ \
94+
"name": "env", \
95+
"kwds": { \
96+
"PATH": "/opt/dcm2niix-v1.0.20211006/bin:$PATH" \
97+
} \
98+
}, \
99+
{ \
100+
"name": "run", \
101+
"kwds": { \
102+
"command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n ca-certificates \\\\\\n cmake \\\\\\n g++ \\\\\\n gcc \\\\\\n git \\\\\\n make \\\\\\n pigz \\\\\\n zlib1g-dev\\nrm -rf /var/lib/apt/lists/*\\ngit clone https://github.com/rordenlab/dcm2niix /tmp/dcm2niix\\ncd /tmp/dcm2niix\\ngit fetch --tags\\ngit checkout v1.0.20211006\\nmkdir /tmp/dcm2niix/build\\ncd /tmp/dcm2niix/build\\ncmake -DCMAKE_INSTALL_PREFIX:PATH=/opt/dcm2niix-v1.0.20211006 ..\\nmake -j1\\nmake install\\nrm -rf /tmp/dcm2niix" \
103+
} \
104+
}, \
105+
{ \
106+
"name": "install", \
107+
"kwds": { \
108+
"pkgs": [ \
109+
"git", \
110+
"gcc", \
111+
"pigz", \
112+
"liblzma-dev", \
113+
"libc-dev", \
114+
"git-annex-standalone", \
115+
"netbase" \
116+
], \
117+
"opts": null \
118+
} \
119+
}, \
120+
{ \
121+
"name": "run", \
122+
"kwds": { \
123+
"command": "apt-get update -qq \\\\\\n && apt-get install -y -q --no-install-recommends \\\\\\n gcc \\\\\\n git \\\\\\n git-annex-standalone \\\\\\n libc-dev \\\\\\n liblzma-dev \\\\\\n netbase \\\\\\n pigz \\\\\\n && rm -rf /var/lib/apt/lists/*" \
124+
} \
125+
}, \
126+
{ \
127+
"name": "copy", \
128+
"kwds": { \
129+
"source": [ \
130+
".", \
131+
"/src/heudiconv" \
132+
], \
133+
"destination": "/src/heudiconv" \
134+
} \
135+
}, \
136+
{ \
137+
"name": "env", \
138+
"kwds": { \
139+
"CONDA_DIR": "/opt/miniconda-latest", \
140+
"PATH": "/opt/miniconda-latest/bin:$PATH" \
141+
} \
142+
}, \
143+
{ \
144+
"name": "run", \
145+
"kwds": { \
146+
"command": "apt-get update -qq\\napt-get install -y -q --no-install-recommends \\\\\\n bzip2 \\\\\\n ca-certificates \\\\\\n curl\\nrm -rf /var/lib/apt/lists/*\\n# Install dependencies.\\nexport PATH=\\"/opt/miniconda-latest/bin:$PATH\\"\\necho \\"Downloading Miniconda installer ...\\"\\nconda_installer=\\"/tmp/miniconda.sh\\"\\ncurl -fsSL -o \\"$conda_installer\\" https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh\\nbash \\"$conda_installer\\" -b -p /opt/miniconda-latest\\nrm -f \\"$conda_installer\\"\\nconda update -yq -nbase conda\\n# Prefer packages in conda-forge\\nconda config --system --prepend channels conda-forge\\n# Packages in lower-priority channels not considered if a package with the same\\n# name exists in a higher priority channel. Can dramatically speed up installations.\\n# Conda recommends this as a default\\n# https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-channels.html\\nconda config --set channel_priority strict\\nconda config --system --set auto_update_conda false\\nconda config --system --set show_channel_urls true\\n# Enable `conda activate`\\nconda init bash\\nconda install -y --name base \\\\\\n \\"python=3.7\\" \\\\\\n \\"traits>=4.6.0\\" \\\\\\n \\"scipy\\" \\\\\\n \\"numpy\\" \\\\\\n \\"nomkl\\" \\\\\\n \\"pandas\\"\\nbash -c \\"source activate base\\n python -m pip install --no-cache-dir --editable \\\\\\n \\"/src/heudiconv[all]\\"\\"\\n# Clean up\\nsync && conda clean --all --yes && sync\\nrm -rf ~/.cache/pip/*" \
147+
} \
148+
}, \
149+
{ \
150+
"name": "entrypoint", \
151+
"kwds": { \
152+
"args": [ \
153+
"heudiconv" \
154+
] \
155+
} \
156+
} \
157+
] \
158+
}' > /.reproenv.json
159+
# End saving to specification to JSON.

utils/gen-docker-image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ docker run --rm $image generate docker -b neurodebian:bullseye -p apt \
1111
--dcm2niix version=v1.0.20211006 method=source \
1212
--install git gcc pigz liblzma-dev libc-dev git-annex-standalone netbase \
1313
--copy . /src/heudiconv \
14-
--miniconda use_env=base conda_install="python=3.7 traits>=4.6.0 scipy numpy nomkl pandas" \
14+
--miniconda version=latest conda_install="python=3.7 traits>=4.6.0 scipy numpy nomkl pandas" \
1515
pip_install="/src/heudiconv[all]" \
1616
pip_opts="--editable" \
1717
--entrypoint "heudiconv" \

0 commit comments

Comments
 (0)