forked from poldracklab/ds003-post-fMRIPrep-analysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
105 lines (89 loc) · 3.75 KB
/
Dockerfile
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# Use Ubuntu 16.04 LTS
FROM ubuntu:xenial-20161213
# Pre-cache neurodebian key
COPY .docker/neurodebian.gpg /usr/local/etc/neurodebian.gpg
# Prepare environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
curl \
bzip2 \
ca-certificates \
xvfb \
cython3 \
build-essential \
autoconf \
libtool \
pkg-config \
git && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Installing Neurodebian packages (FSL, AFNI, git)
RUN curl -sSL "http://neuro.debian.net/lists/xenial.us-ca.full" >> /etc/apt/sources.list.d/neurodebian.sources.list && \
apt-key add /usr/local/etc/neurodebian.gpg && \
(apt-key adv --refresh-keys --keyserver hkp://ha.pool.sks-keyservers.net 0xA5D32F012649A5A9 || true)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
fsl-core=5.0.9-5~nd16.04+1 && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
ENV FSLDIR="/usr/share/fsl/5.0" \
FSLOUTPUTTYPE="NIFTI_GZ" \
FSLMULTIFILEQUIT="TRUE" \
POSSUMDIR="/usr/share/fsl/5.0" \
LD_LIBRARY_PATH="/usr/lib/fsl/5.0:$LD_LIBRARY_PATH" \
FSLTCLSH="/usr/bin/tclsh" \
FSLWISH="/usr/bin/wish"
# Create a shared $HOME directory
RUN useradd -m -s /bin/bash -G users bidsapp
WORKDIR /home/bidsapp
ENV HOME="/home/bidsapp" \
USER="bidsapp"
# Installing and setting up miniconda
RUN curl -sSLO https://repo.continuum.io/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh && \
bash Miniconda3-4.5.11-Linux-x86_64.sh -b -p /usr/local/miniconda && \
rm Miniconda3-4.5.11-Linux-x86_64.sh
# Set CPATH for packages relying on compiled libs (e.g. indexed_gzip)
ENV PATH="/usr/lib/fsl/5.0:/usr/local/miniconda/bin:$PATH" \
CPATH="/usr/local/miniconda/include/:$CPATH" \
LANG="C.UTF-8" \
LC_ALL="C.UTF-8" \
PYTHONNOUSERSITE=1
# Installing precomputed python packages
RUN conda install -y python=3.7.1 \
mkl=2018.0.3 \
mkl-service \
numpy=1.15.4 \
scipy=1.1.0 \
scikit-learn=0.19.1 \
matplotlib=2.2.2 \
pandas=0.23.4 \
libxml2=2.9.8 \
libxslt=1.1.32 \
graphviz=2.40.1 \
traits=4.6.0 \
zlib; sync && \
chmod -R a+rX /usr/local/miniconda; sync && \
chmod +x /usr/local/miniconda/bin/*; sync && \
conda build purge-all; sync && \
conda clean -tipsy && sync
# Unless otherwise specified each process should only use one thread - nipype
# will handle parallelization
ENV MKL_NUM_THREADS=1 \
OMP_NUM_THREADS=1
# Precaching fonts, set 'Agg' as default backend for matplotlib
RUN python -c "from matplotlib import font_manager" && \
sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" )
# Installing dev requirements (packages that are not in pypi)
WORKDIR /src/
COPY requirements.txt requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
# Replace FSL's imglob (which is Python 2)
RUN rm -f /usr/share/fsl/5.0/bin/imglob && \
chmod a+rx $( python -c 'import site; print(site.getsitepackages()[0])' )/nipype/external/fsl_imglob.py && \
ln -s $( python -c 'import site; print(site.getsitepackages()[0])' )/nipype/external/fsl_imglob.py /usr/share/fsl/5.0/bin/imglob
RUN find $HOME -type d -exec chmod go=u {} + && \
find $HOME -type f -exec chmod go=u {} +
# Installing this module
COPY . /src/
ENV PYTHONPATH="/src:$PYTHONPATH"
RUN ldconfig
WORKDIR /tmp/
ENTRYPOINT ["/src/run.py"]