-
Notifications
You must be signed in to change notification settings - Fork 22
/
Dockerfile
187 lines (149 loc) · 6.94 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
ARG PYTHON_VERSION=python-3.10
ARG BASE_IMAGE=jupyter/scipy-notebook
FROM $BASE_IMAGE:$PYTHON_VERSION
LABEL org.opencontainers.image.source="https://github.com/MaastrichtU-IDS/jupyterlab"
ENV TZ=Europe/Amsterdam \
JUPYTER_ENABLE_LAB=yes \
PYTHONUNBUFFERED=1
# GRANT_SUDO=yes
# CHOWN_HOME=yes \
# CHOWN_HOME_OPTS='-R'
# Install yarn for handling npm packages
RUN npm install --global yarn
# Enable yarn global add:
ENV PATH="$PATH:$HOME/.yarn/bin"
# Install extensions for JupyterLab with conda and pip
# Multi conda kernels: # https://stackoverflow.com/questions/53004311/how-to-add-conda-environment-to-jupyter-lab
RUN mamba install --quiet -y \
openjdk=11 \
maven \
ipython-sql \
jupyterlab-git \
jupyterlab-lsp \
jupyter-lsp-python \
python-lsp-server \
# jupyterlab \
# ipywidgets \
# jupyter_bokeh \
# jupyterlab-drawio \
jupyterlab_rise \
nb_conda_kernels \
'jupyter-server-proxy>=3.1.0'
# mamba install -y -c plotly 'plotly>=4.8.2'
## Install BeakerX kernels? Requires python 3.7
# mamba install -y -c beakerx beakerx_kernel_java beakerx_kernel_scala
RUN pip install --upgrade pip && \
pip install --upgrade \
jupyterlab-spreadsheet-editor \
hatch \
jupyterlab-github \
jupyterlab-system-monitor
# jupyterlab_latex \
# mitosheet3
## Could also be interesting to install:
# jupyterlab_theme_solarized_dark \
# elyra (pipeline builder for Kubeflow and Airflow)
# Change to root user to install things
USER root
RUN apt-get update && \
apt-get install -y tzdata curl wget unzip bzip2 zsh vim htop gfortran \
python3-dev libpq-dev libclang-dev
# Install Java kernel
RUN wget -O /opt/ijava-kernel.zip https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip && \
unzip /opt/ijava-kernel.zip -d /opt/ijava-kernel && \
cd /opt/ijava-kernel && \
python install.py --sys-prefix && \
rm /opt/ijava-kernel.zip
# Install VS Code server and extensions
RUN curl -fsSL https://code-server.dev/install.sh | sh
RUN code-server --install-extension redhat.vscode-yaml \
--install-extension ms-python.python \
--install-extension anwar.resourcemonitor \
--install-extension rintoj.json-organizer \
--install-extension zaaack.markdown-editor \
--install-extension garlicbreadcleric.document-preview \
--install-extension bungcip.better-toml \
--install-extension vscjava.vscode-java-pack \
--install-extension ginfuru.ginfuru-better-solarized-dark-theme \
--install-extension oderwat.indent-rainbow \
--install-extension mechatroner.rainbow-csv \
--install-extension GrapeCity.gc-excelviewer \
--install-extension yzhang.markdown-all-in-one \
--install-extension redhat.vscode-xml \
--install-extension ms-mssql.mssql \
# --install-extension ms-azuretools.vscode-docker \
--install-extension eamodio.gitlens
RUN cd /opt && \
export EXT_VERSION=0.1.2 && \
wget https://open-vsx.org/api/vemonet/stardog-rdf-grammars/$EXT_VERSION/file/vemonet.stardog-rdf-grammars-$EXT_VERSION.vsix && \
code-server --install-extension vemonet.stardog-rdf-grammars-$EXT_VERSION.vsix
## Not compatible with web yet: https://github.com/janisdd/vscode-edit-csv/issues/67
# RUN cd /opt && \
# export EXT_VERSION=0.6.4 && \
# wget https://github.com/janisdd/vscode-edit-csv/releases/download/v$EXT_VERSION/vscode-edit-csv-$EXT_VERSION.vsix && \
# code-server --install-extension vscode-edit-csv-$EXT_VERSION.vsix
# Install open source gitpod VSCode? https://github.com/gitpod-io/openvscode-releases/blob/main/Dockerfile
# ENV OPENVSCODE_SERVER_ROOT=/opt/openvscode \
# RELEASE_TAG=openvscode-server-v1.62.3
# ENV LANG=C.UTF-8 \
# LC_ALL=C.UTF-8 \
# EDITOR=code \
# VISUAL=code \
# GIT_EDITOR="code --wait" \
# OPENVSCODE_SERVER_ROOT=${OPENVSCODE_SERVER_ROOT}
# RUN wget https://github.com/gitpod-io/openvscode-server/releases/download/${RELEASE_TAG}/${RELEASE_TAG}-linux-x64.tar.gz && \
# tar -xzf ${RELEASE_TAG}-linux-x64.tar.gz && \
# mv -f ${RELEASE_TAG}-linux-x64 ${OPENVSCODE_SERVER_ROOT} && \
# rm -f ${RELEASE_TAG}-linux-x64.tar.gz
# Install oc, kubectl and Helm
RUN cd /tmp && \
wget https://mirror.openshift.com/pub/openshift-v4/clients/oc/latest/linux/oc.tar.gz && \
tar xvf oc.tar.gz && \
mv oc kubectl /usr/local/bin/ && \
wget https://github.com/kubeflow/kfctl/releases/download/v1.2.0/kfctl_v1.2.0-0-gbc038f9_linux.tar.gz && \
tar -xzf kfctl_v1.2.0-0-gbc038f9_linux.tar.gz && \
mv kfctl /usr/local/bin/ && \
wget https://get.helm.sh/helm-v3.8.2-linux-386.tar.gz && \
tar -xzf helm-*-linux-386.tar.gz && \
mv linux-386/helm /usr/local/bin/
# Add JupyterLab and VSCode settings
COPY icons/*.svg /etc/jupyter/
COPY jupyter_notebook_config.py /etc/jupyter/jupyter_notebook_config.py
RUN fix-permissions $CONDA_DIR && \
fix-permissions /home/$NB_USER && \
fix-permissions /home/$NB_USER/.local && \
fix-permissions /opt && \
fix-permissions /etc/jupyter
# Switch back to the notebook user to finish installation
USER ${NB_UID}
# Add config files for JupyterLab and VSCode
COPY settings.json /home/$NB_USER/.local/share/code-server/User/settings.json
# RUN mkdir -p ~/.jupyter/lab/user-settings/@jupyterlab/terminal-extension
# COPY --chown=$NB_USER:100 plugin.jupyterlab-settings /home/$NB_USER/.jupyter/lab/user-settings/@jupyterlab/terminal-extension/plugin.jupyterlab-settings
# COPY themes.jupyterlab-settings /home/$NB_USER/.jupyter/lab/user-settings/@jupyterlab/apputils-extension/themes.jupyterlab-settings
RUN mkdir -p /home/$NB_USER/work
# Update and compile JupyterLab extensions?
# RUN jupyter labextension update --all && \
# jupyter lab build
# Install Oh My ZSH! and custom theme
RUN sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
RUN curl -fsSL -o ~/.oh-my-zsh/custom/themes/biratime.zsh-theme https://raw.github.com/vemonet/biratime/main/biratime.zsh-theme
RUN sed -i 's/^ZSH_THEME=".*"$/ZSH_THEME="biratime"/g' ~/.zshrc
RUN echo "\`conda config --set changeps1 false\`" >> ~/.oh-my-zsh/plugins/virtualenv/virtualenv.plugin.zsh
RUN echo 'setopt NO_HUP' >> ~/.zshrc
ENV SHELL=/bin/zsh
USER root
RUN chsh -s /bin/zsh
USER ${NB_UID}
# Add some local scripts/shortcuts
ADD bin/* ~/.local/bin/
ENV WORKSPACE="/home/${NB_USER}/work"
WORKDIR ${WORKSPACE}
# Presets for git
RUN git config --global credential.helper "store --file $HOME/.git-credentials" && \
git config --global diff.colorMoved zebra && \
git config --global fetch.prune true && \
git config --global pull.rebase false
ADD README.ipynb $WORKSPACE
CMD [ "start-notebook.sh", "--no-browser", "--ip=0.0.0.0", "--config=/etc/jupyter/jupyter_notebook_config.py" ]
# ENTRYPOINT ["jupyter", "lab", "--allow-root", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--config=/etc/jupyter/jupyter_notebook_config.py"]