-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
109 lines (96 loc) · 3.92 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
106
107
108
109
# NiPreps' QC-Book Docker Container Image distribution
#
# MIT License
#
# Copyright (c) 2021 The NiPreps Developers
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
FROM jupyter/datascience-notebook:2022-03-02
RUN arch=$(uname -m) && \
if [ "${arch}" == "aarch64" ]; then \
# Prevent libmamba from sporadically hanging on arm64 under QEMU
# <https://github.com/mamba-org/mamba/issues/1611>
export G_SLICE=always-malloc; \
fi && \
mamba install --quiet --yes 'r-rnifti' && \
mamba clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
USER root
# Prepare environment
RUN apt-get update && \
apt-get install -y --no-install-recommends \
ca-certificates \
curl \
dvipng \
fontconfig \
git \
unzip && \
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Install Libre Franklin font
RUN curl -sSL "https://fonts.google.com/download?family=Libre%20Franklin" -o /tmp/LibreFranklin.zip \
&& mkdir -p /usr/local/share/fonts/LibreFranklin \
&& pushd /usr/local/share/fonts/LibreFranklin \
&& unzip -e /tmp/LibreFranklin.zip \
&& popd \
&& rm /tmp/LibreFranklin.zip \
&& fix-permissions /usr/local/share/fonts/LibreFranklin
USER $NB_UID
RUN fc-cache -v
# Installing precomputed python packages
RUN conda install -y -c conda-forge \
attr \
jupytext \
nbgitpuller \
nibabel \
nilearn \
matplotlib \
numpy \
pandas \
pip \
requests \
scipy \
scikit-learn \
zlib && \
conda clean --all -f -y && \
fix-permissions "${CONDA_DIR}" && \
fix-permissions "/home/${NB_USER}"
RUN jupyter labextension install @jupyter-widgets/jupyterlab-manager --no-build \
&& export NODE_OPTIONS=--max-old-space-size=4096 \
&& jupyter lab build && \
jupyter lab clean && \
jlpm cache clean && \
npm cache clean --force && \
rm -rf $HOME/.node-gyp && \
rm -rf $HOME/.local && rm -rf /tmp/*
# Installing requirements
COPY requirements.txt /tmp/requirements.txt
USER root
RUN pip install --no-cache-dir -r /tmp/requirements.txt \
&& fix-permissions "${CONDA_DIR}" \
&& rm /tmp/requirements.txt
USER $NB_UID
# Precaching fonts, set 'Agg' as default backend for matplotlib
RUN rm -rf /home/${NB_USER}/.cache/matplotlib \
&& python -c "from matplotlib import font_manager" \
&& sed -i 's/\(backend *: \).*$/\1Agg/g' $( python -c "import matplotlib; print(matplotlib.matplotlib_fname())" ) \
&& mkdir -p /home/${NB_USER}/.config/ \
&& echo 'notebook_extensions = "ipynb,Rmd"' >> /home/${NB_USER}/.config/jupytext.toml
ARG GITHUB_PAT
RUN R -e "devtools::install_github('AWKruijt/eMergeR')"