Skip to content

Commit cdbbe70

Browse files
committed
NeuroDebian
1 parent cf44477 commit cdbbe70

File tree

2 files changed

+123
-0
lines changed

2 files changed

+123
-0
lines changed

vendor/neuro/Dockerfile

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
FROM ubuntu:bionic
2+
3+
# https://bugs.debian.org/830696 (apt uses gpgv by default in newer releases, rather than gpg)
4+
RUN set -x \
5+
&& apt-get update \
6+
&& { \
7+
which gpg \
8+
|| apt-get install -y --no-install-recommends gnupg \
9+
; } \
10+
# Ubuntu includes "gnupg" (not "gnupg2", but still 2.x), but not dirmngr, and gnupg 2.x requires dirmngr
11+
# so, if we're not running gnupg 1.x, explicitly install dirmngr too
12+
&& { \
13+
gpg --version | grep -q '^gpg (GnuPG) 1\.' \
14+
|| apt-get install -y --no-install-recommends dirmngr \
15+
; } \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
# apt-key is a bit finicky during "docker build" with gnupg 2.x, so install the repo key the same way debian-archive-keyring does (/etc/apt/trusted.gpg.d)
19+
# this makes "apt-key list" output prettier too!
20+
RUN set -x \
21+
&& export GNUPGHOME="$(mktemp -d)" \
22+
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys DD95CC430502E37EF840ACEEA5D32F012649A5A9 \
23+
&& gpg --batch --export DD95CC430502E37EF840ACEEA5D32F012649A5A9 > /etc/apt/trusted.gpg.d/neurodebian.gpg \
24+
&& rm -rf "$GNUPGHOME" \
25+
&& apt-key list | grep neurodebian
26+
27+
RUN { \
28+
echo 'deb http://neuro.debian.net/debian bionic main'; \
29+
echo 'deb http://neuro.debian.net/debian data main'; \
30+
echo '#deb-src http://neuro.debian.net/debian-devel bionic main'; \
31+
} > /etc/apt/sources.list.d/neurodebian.sources.list
32+
33+
# Minimalistic package to assist with freezing the APT configuration
34+
# which would be coming from neurodebian repo.
35+
# Also install and enable eatmydata to be used for all apt-get calls
36+
# to speed up docker builds.
37+
RUN set -x \
38+
&& apt-get update \
39+
&& apt-get install -y --no-install-recommends neurodebian-freeze eatmydata \
40+
&& ln -s /usr/bin/eatmydata /usr/local/bin/apt-get \
41+
&& rm -rf /var/lib/apt/lists/*
42+
43+
RUN apt-get update && \
44+
apt-get install -y \
45+
ca-certificates \
46+
wget curl git-core \
47+
vim-tiny zip unzip \
48+
python3 python3-pip \
49+
libssl-dev \
50+
libmpdec2 \
51+
proj-bin libproj-dev \
52+
libgeos-dev libgeos++-dev \
53+
mime-support \
54+
gcc g++ && \
55+
apt-get clean && \
56+
rm -rf /var/lib/apt/lists/
57+
58+
ENV PYTHONUNBUFFERED=1 \
59+
PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
60+
LANG=C.UTF-8
61+
62+
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
63+
python3 -m pip install --no-cache-dir -U setuptools && \
64+
python3 -m pip install --no-cache-dir h5py && \
65+
python3 -m pip install --no-cache-dir Cython && \
66+
python3 -m pip install --no-cache-dir matplotlib bokeh && \
67+
python3 -m pip install --no-cache-dir versioneer==0.17 && \
68+
python3 -m pip install --no-cache-dir pyproj Cartopy==0.16 && \
69+
python3 -m pip install --no-cache-dir pandas && \
70+
python3 -m pip install --no-cache-dir seaborn && \
71+
python3 -m pip install --no-cache-dir pillow && \
72+
python3 -m pip install --no-cache-dir networkx cvxpy && \
73+
python3 -m pip install --no-cache-dir scikit-learn scikit-image && \
74+
python3 -m pip install --no-cache-dir pygments && \
75+
python3 -m pip install --no-cache-dir ipython && \
76+
python3 -m pip install --no-cache-dir jupyter && \
77+
python3 -m pip install --no-cache-dir jupyterlab && \
78+
rm -rf /root/.cache && \
79+
rm -f /tmp/*.whl
80+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
81+
82+
# Install ipython kernelspec
83+
RUN python3 -m ipykernel install --display-name "NeuroDebian on Backend.AI" && \
84+
cat /usr/local/share/jupyter/kernels/python3/kernel.json
85+
86+
# Backend.AI specifics
87+
LABEL ai.backend.kernelspec="1" \
88+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
89+
ai.backend.features="batch query uid-match user-input" \
90+
ai.backend.resource.min.cpu="1" \
91+
ai.backend.resource.min.mem="256m" \
92+
ai.backend.base-distro="ubuntu16.04" \
93+
ai.backend.runtime-type="python" \
94+
ai.backend.runtime-path="/usr/bin/python3" \
95+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8080,jupyterlab:http:8090"
96+
COPY policy.yml /etc/backend.ai/jail/policy.yml

vendor/neuro/policy.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
whitelist_paths:
2+
OP_OPEN: ["*"]
3+
OP_ACCESS: ["*"]
4+
OP_EXEC: ["*"]
5+
OP_STAT: ["*"]
6+
OP_CHMOD: ["/home/work/*", "/tmp/*"]
7+
exec_allowance: -1
8+
fork_allowance: -1
9+
max_child_procs: 32
10+
extra_envs: []
11+
preserved_env_keys: [
12+
"HOME", "PATH", "LANG",
13+
"USER", "SHELL", "TERM",
14+
"LD_LIBRARY_PATH",
15+
"LD_PRELOAD",
16+
# Python-specific
17+
"PYTHONPATH",
18+
"PYTHONUNBUFFERED",
19+
"MPLCONFIGDIR",
20+
"OPENBLAS_NUM_THREADS",
21+
]
22+
23+
diff_to_default: true
24+
25+
# Following syscalls are blindly allowed.
26+
# IMPORTANT: ptrace MUST NOT be included!
27+
allowed_syscalls:

0 commit comments

Comments
 (0)