forked from MIC-DKFZ/TractSeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile_CPU
executable file
·58 lines (46 loc) · 2.36 KB
/
Dockerfile_CPU
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
# Neurodocker version 0.4.0
FROM neurodebian:stretch-non-free
ARG DEBIAN_FRONTEND="noninteractive"
# Libraries needed to compile python
RUN apt-get update -qq \
&& apt-get install -qq build-essential libbz2-dev zlib1g-dev libncurses5-dev libgdbm-dev \
&& apt-get install -qq libnss3-dev libssl-dev libreadline-dev libffi-dev wget \
&& apt-get install -qq software-properties-common git curl
# Compiling python 3.7
RUN cd /usr/src \
&& wget -q https://www.python.org/ftp/python/3.7.9/Python-3.7.9.tgz \
&& tar xzf Python-3.7.9.tgz \
&& cd Python-3.7.9 \
&& ./configure --enable-optimizations >/dev/null \
&& make install > /dev/null
# Install fsl (needed for bet and flirt)
RUN apt-get update -qq \
&& apt-get install -qq --no-install-recommends fsl-core \
&& apt-get clean -qq \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN pip3.7 install -q --upgrade pip \
&& pip3.7 install -q wheel numpy scipy nilearn matplotlib scikit-image nibabel dipy fury joblib seaborn cython \
&& pip3.7 install -q torch==1.6.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
RUN mkdir -p ~/.tractseg \
&& mkdir -p /code \
&& curl -sSL -o /code/mrtrix3_RC3.tar.gz https://zenodo.org/record/1415322/files/mrtrix3_RC3.tar.gz?download=1
RUN tar -zxf /code/mrtrix3_RC3.tar.gz -C code \
&& /code/mrtrix3/set_path
# Uncomment if we want to rebuild the following commands (otherwise using cache)
#RUN echo "rebuild"
RUN pip3.7 install -q --upgrade https://github.com/MIC-DKFZ/TractSeg/archive/master.zip
# Sometimes fails if running everything from cache -> uncomment line "RUN echo 'rebuild'"
RUN download_all_pretrained_weights
# Setup environment (make all commands available)
ENV ND_ENTRYPOINT="/code/startup.sh"
RUN touch "$ND_ENTRYPOINT" \
&& echo '#!/bin/bash' >> "$ND_ENTRYPOINT" \
&& echo 'set -e' >> "$ND_ENTRYPOINT" \
&& echo 'source /etc/fsl/fsl.sh' >> "$ND_ENTRYPOINT" \
&& echo 'export PATH=/code/mrtrix3/bin:$PATH' >> "$ND_ENTRYPOINT" \
&& echo 'exec "$@"' >> "$ND_ENTRYPOINT" \
&& chmod -R 777 /code && chmod a+s /code
# This will be executed. Arguments passed on the command line will be passed as arguments to this
# script. So in this script we first setup the environment and then we execute (using exec) the
# commands which were provided on the command line (available via $@)
ENTRYPOINT ["/code/startup.sh"]