Skip to content

Commit 2f0b112

Browse files
committed
add: Julia 1.5 kernel
1 parent 399e821 commit 2f0b112

File tree

12 files changed

+232
-12
lines changed

12 files changed

+232
-12
lines changed

julia/Dockerfile.1.5-ubuntu20.04

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
FROM ubuntu:20.04
2+
# Ubuntu 20.04 comes with Python 3.8
3+
ENV DEBIAN_FRONTEND noninteractive
4+
RUN apt-get update && \
5+
apt-get install -y \
6+
ca-certificates \
7+
wget curl git-core \
8+
vim-tiny zip unzip \
9+
python3 python3-pip \
10+
libssl-dev \
11+
libmpdec2 \
12+
proj-bin libproj-dev \
13+
libgeos-dev libgeos++-dev \
14+
mime-support \
15+
gcc g++ \
16+
cmake \
17+
ncurses-term && \
18+
apt-get clean && \
19+
rm -rf /var/lib/apt/lists/
20+
21+
RUN ln -sf /usr/share/terminfo/x/xterm-color /usr/share/terminfo/x/xterm-256color
22+
23+
ENV PYTHONUNBUFFERED=1 \
24+
PATH=/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
25+
LANG=C.UTF-8
26+
27+
RUN curl https://bootstrap.pypa.io/get-pip.py | python3 && \
28+
python3 -m pip install --no-cache-dir -U setuptools && \
29+
python3 -m pip install --no-cache-dir h5py && \
30+
python3 -m pip install --no-cache-dir Cython && \
31+
python3 -m pip install --no-cache-dir matplotlib bokeh && \
32+
python3 -m pip install --no-cache-dir versioneer && \
33+
python3 -m pip install --no-cache-dir pyproj Cartopy && \
34+
python3 -m pip install --no-cache-dir pandas && \
35+
python3 -m pip install --no-cache-dir seaborn && \
36+
python3 -m pip install --no-cache-dir pillow && \
37+
python3 -m pip install --no-cache-dir networkx cvxpy && \
38+
python3 -m pip install --no-cache-dir scikit-learn scikit-image && \
39+
python3 -m pip install --no-cache-dir pygments && \
40+
python3 -m pip install --no-cache-dir ipython && \
41+
python3 -m pip install --no-cache-dir jupyter && \
42+
python3 -m pip install --no-cache-dir jupyterlab && \
43+
rm -rf /root/.cache && \
44+
rm -f /tmp/*.whl
45+
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 2
46+
47+
# Install jupyter & Julia
48+
ARG JULIA_VERSION
49+
ENV JULIA_VERSION ${JULIA_VERSION:-1.5.3}
50+
ENV JULIA_PATH "/usr/local/julia"
51+
ENV PATH $JULIA_PATH:$JULIA_PATH/bin:$PATH
52+
53+
RUN dpkgArch="$(dpkg --print-architecture)"; \
54+
case "${dpkgArch##*-}" in \
55+
amd64) tarArch='x86_64'; dirArch='x64';; \
56+
armhf) tarArch='arm'; dirArch='arm';; \
57+
i386) tarArch='i686'; dirArch='x86';; \
58+
*) echo >&2 "error: current architecture ($dpkgArch) does not have a corresponding Julia binary release"; exit 1 ;; \
59+
esac; \
60+
\
61+
curl -fL -o julia.tar.gz "https://julialang-s3.julialang.org/bin/linux/${dirArch}/${JULIA_VERSION%[.-]*}/julia-${JULIA_VERSION}-linux-${tarArch}.tar.gz"; \
62+
\
63+
mkdir "$JULIA_PATH"; \
64+
tar -xzf julia.tar.gz -C "$JULIA_PATH" --strip-components 1; \
65+
rm julia.tar.gz
66+
67+
#add IJulia package to make Julia kernel available in jupyter
68+
ENV JULIA_PKG_LOC /opt/julia
69+
ENV JULIA_LOAD_PATH :/opt/julia
70+
ENV JULIA_DEPOT_PATH /opt/julia
71+
RUN mkdir ${JULIA_PKG_LOC}
72+
RUN julia -e 'ENV["JUPYTER"]="jupyter"' && \
73+
julia -e 'ENV["PYTHON"]="python3"' && \
74+
julia -e 'ENV["JULIA_DEPOT_PATH"]="/opt/julia"' && \
75+
julia -e 'using Pkg; Pkg.add("IJulia");'
76+
77+
RUN julia -e 'using Pkg; Pkg.add("DataFrames");' && \
78+
julia -e 'using Pkg; Pkg.add("RDatasets");' && \
79+
julia -e 'using Pkg; Pkg.add("PyPlot");' && \
80+
julia -e 'using Pkg; Pkg.add("Plots"); using Plots;' && \
81+
julia -e 'using Pkg; Pkg.add("CSV");' && \
82+
julia -e 'using Pkg; Pkg.add("Pandas"); using Pandas;'
83+
84+
SHELL ["/bin/bash", "-c"]
85+
RUN julia -e 'using IJulia' && \
86+
chmod -R 755 /opt/julia/compiled
87+
SHELL ["/bin/sh", "-c"]
88+
# Install ipython kernelspec
89+
COPY kernel.json /usr/local/share/jupyter/kernels/julia-1.5/kernel.json
90+
COPY logo-32x32.png /usr/local/share/jupyter/kernels/julia-1.5/logo-32x32.png
91+
COPY logo-64x64.png /usr/local/share/jupyter/kernels/julia-1.5/logo-64x64.png
92+
93+
# Backend.AI specifics
94+
LABEL ai.backend.kernelspec="1" \
95+
ai.backend.envs.corecount="OPENBLAS_NUM_THREADS,OMP_NUM_THREADS,NPROC" \
96+
ai.backend.features="batch query uid-match user-input" \
97+
ai.backend.resource.min.cpu="1" \
98+
ai.backend.resource.min.mem="512m" \
99+
ai.backend.base-distro="ubuntu20.04" \
100+
ai.backend.runtime-type="python" \
101+
ai.backend.runtime-path="/usr/bin/python3" \
102+
ai.backend.service-ports="ipython:pty:3000,jupyter:http:8070,jupyterlab:http:8090"
103+
COPY policy.yml /etc/backend.ai/jail/policy.yml
104+
ENV JULIA_DEPOT_PATH /home/work/.julia:/opt/julia
105+
ENV JULIA_PROJECT /home/work/.julia
106+
# vim: ft=dockerfile
107+

julia/kernel.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"display_name": "Julia 1.0.3",
3-
"argv": [
4-
"/usr/local/julia/bin/julia",
5-
"-i",
6-
"--startup-file=yes",
7-
"--color=yes",
8-
"/opt/julia/IJulia/src/kernel.jl",
9-
"{connection_file}"
10-
],
11-
"language": "julia",
12-
"env": {}
13-
}
2+
"display_name": "Julia 1.5 on Backend.AI",
3+
"argv": [
4+
"/usr/local/julia/bin/julia",
5+
"-i",
6+
"--startup-file=yes",
7+
"--color=yes",
8+
"/opt/julia/packages/IJulia/IDNmS/src/kernel.jl",
9+
"{connection_file}"
10+
],
11+
"language": "julia",
12+
"env": {}
13+
}

julia/logo-32x32.png

2.46 KB
Loading

julia/logo-64x64.png

4.01 KB
Loading

julia/service-defs/digits.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"command": [
3+
"{runtime_path}", "-m", "digits"
4+
]
5+
}

julia/service-defs/ipython.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"command": [
3+
"{runtime_path}", "-m", "IPython"
4+
]
5+
}

julia/service-defs/jupyter.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"prestart": [
3+
{
4+
"action": "write_tempfile",
5+
"args": {
6+
"body": [
7+
"c.NotebookApp.allow_root = True\n",
8+
"c.NotebookApp.ip = \"0.0.0.0\"\n",
9+
"c.NotebookApp.port = {ports[0]}\n",
10+
"c.NotebookApp.token = \"\"\n",
11+
"c.FileContentsManager.delete_to_trash = False\n"
12+
]
13+
},
14+
"ref": "jupyter_cfg"
15+
}
16+
],
17+
"command": [
18+
"{runtime_path}", "-m", "notebook", "--no-browser", "--config", "{jupyter_cfg}"
19+
]
20+
}

julia/service-defs/jupyterlab.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"prestart": [
3+
{
4+
"action": "write_tempfile",
5+
"args": {
6+
"body": [
7+
"c.NotebookApp.allow_root = True\n",
8+
"c.NotebookApp.ip = \"0.0.0.0\"\n",
9+
"c.NotebookApp.port = {ports[0]}\n",
10+
"c.NotebookApp.token = \"\"\n",
11+
"c.FileContentsManager.delete_to_trash = False\n"
12+
]
13+
},
14+
"ref": "jupyter_cfg"
15+
}
16+
],
17+
"command": [
18+
"{runtime_path}", "-m", "jupyterlab", "--no-browser", "--config", "{jupyter_cfg}"
19+
]
20+
}

julia/service-defs/nni.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"prestart": [
3+
{
4+
"action": "mkdir",
5+
"args": {
6+
"path": "/home/work/.config/nni"
7+
}
8+
}
9+
],
10+
"command": [
11+
"{runtime_path}",
12+
"-m", "nni.main",
13+
"--logdir", "/home/work/logs",
14+
"--create", "/home/work/.config/nni/config.yml",
15+
"--host", "0.0.0.0",
16+
"--port", "{ports[0]}"
17+
]
18+
}

julia/service-defs/sftp.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"command": [
3+
"{runtime_path}", "-m", "sftpserver", "--port", "{ports[0]}"
4+
]
5+
}

0 commit comments

Comments
 (0)