-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile.dev
93 lines (72 loc) · 3.59 KB
/
Dockerfile.dev
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
FROM archlinux/base:latest
LABEL maintainer="Cameron Smith <[email protected]>"
# setup environment
ARG NB_USER="jovyan"
ARG NB_UID="1000"
ARG NB_GID="100"
ENV USER ${NB_USER}
ENV HOME /home/${NB_USER}
ENV PATH "${HOME}/.local/bin:${PATH}"
# install arch packages
COPY ./etc ${HOME}/etc
## install primary Arch packages
RUN pacman -Syu --needed --noconfirm - < ${HOME}/etc/pkglist-01.txt && pacman -Scc --noconfirm
RUN groupadd --gid=${NB_GID} ${NB_USER} && \
useradd --create-home --shell=/bin/false --uid=${NB_UID} --gid=${NB_GID} ${NB_USER} && \
echo "${NB_USER} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/notebook && \
sudo -lU ${NB_USER}
# install jupyter
RUN pip install wheel jupyter jupyterlab jupyterlab-git jupyterlab_github nbgitpuller jupyterhub==1.1.0 && \
jupyter serverextension enable --py jupyterlab --sys-prefix && \
jupyter labextension install @jupyterlab/git @jupyterlab/toc @jupyterlab/google-drive @jupyterlab/github @jupyterlab/commenting-extension && \
jupyter serverextension enable --py jupyterlab_git --sys-prefix
## install julia jupyter kernel
RUN julia -e 'using Pkg; Pkg.add("IJulia")'
## install maxima jupyter kernel
RUN git clone https://github.com/cameronraysmith/maxima-jupyter.git ${HOME}/maxima-jupyter
WORKDIR ${HOME}/maxima-jupyter
RUN export PYTHON_SITE=$(python -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])') && \
mkdir -p ${PYTHON_SITE}/notebook/static/components/codemirror/mode/maxima/ && \
cp maxima.js ${PYTHON_SITE}/notebook/static/components/codemirror/mode/maxima/ && \
patch ${PYTHON_SITE}/notebook/static/components/codemirror/mode/meta.js codemirror-mode-meta-patch && \
cp maxima_lexer.py ${PYTHON_SITE}/pygments/lexers/ && \
patch ${PYTHON_SITE}/pygments/lexers/_mapping.py pygments-mapping-patch
RUN curl -O https://beta.quicklisp.org/quicklisp.lisp && \
sbcl --load quicklisp.lisp --load docker-install-quicklisp.lisp && \
maxima --batch-string="load(\"load-maxima-jupyter.lisp\");jupyter_install();"
## install R jupyter kernel
RUN echo "install.packages('IRkernel', repos='http://cran.us.r-project.org')" | R --slave && \
echo "IRkernel::installspec()" | R --slave && \
jupyter kernelspec list
# install secondary Arch packages
RUN pacman -Syu --needed --noconfirm - < ${HOME}/etc/pkglist-02.txt && pacman -Scc --noconfirm
# copy configuration and jupyter theme files
COPY ./scripts ${HOME}/scripts
COPY ./Dockerfile ${HOME}/scripts/
COPY ./etc/themes.jupyterlab-settings ${HOME}/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
COPY ./etc/plugin.jupyterlab-settings ${HOME}/.jupyter/lab/user-settings/@jupyterlab/terminal-extension/plugin.jupyterlab-settings
# Copy startup scripts from jupyter-docker-stacks
COPY stacks/*.sh /usr/local/bin/
COPY stacks/jupyter_notebook_config.py /etc/jupyter/
# reset home directory permissions
RUN chown -R ${NB_UID} ${HOME} && \
chgrp -R ${NB_GID} ${HOME}
USER ${NB_UID}
## install yay AUR package manager
RUN cd /opt && \
sudo rm -rf ./yay-git && \
sudo git clone https://aur.archlinux.org/yay-git.git && \
sudo chown -R ${NB_USER}:${NB_USER} ./yay-git && \
cd yay-git && \
makepkg -si --noconfirm
# install dotfiles framework
WORKDIR ${HOME}
RUN yay -S --needed --noconfirm "rcm>=1.3.3-1" && \
git clone https://github.com/thoughtbot/dotfiles.git ~/dotfiles && \
env RCRC=$HOME/dotfiles/rcrc rcup
# copy home directory to tmp for restoration
RUN mkdir -p /tmp/homedir && \
cp -a ${HOME}/. /tmp/homedir/
# run jupyter lab on localhost:8888 by default
CMD jupyter lab --ip=0.0.0.0 --port=8888
EXPOSE 8888/tcp