From ece23e4907a6135b631c0cf183ed59fce5a6b0c6 Mon Sep 17 00:00:00 2001
From: Moritz Maxeiner <mm@ucw.sh>
Date: Thu, 3 Sep 2020 17:41:12 +0200
Subject: [PATCH] [jupyterhub] Add downstream vim image

---
 .gitlab-ci.yml                                |  7 ++++-
 jupyterhub/{ => base}/Dockerfile              | 26 +++++++++----------
 .../{ => base}/commands.jupyterlab-settings   |  0
 .../{ => base}/jupyter_notebook_config.py     |  0
 .../{ => base}/themes.jupyterlab-settings     |  0
 jupyterhub/vim/Dockerfile                     |  7 +++++
 6 files changed, 26 insertions(+), 14 deletions(-)
 rename jupyterhub/{ => base}/Dockerfile (61%)
 rename jupyterhub/{ => base}/commands.jupyterlab-settings (100%)
 rename jupyterhub/{ => base}/jupyter_notebook_config.py (100%)
 rename jupyterhub/{ => base}/themes.jupyterlab-settings (100%)
 create mode 100755 jupyterhub/vim/Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d5d97c5..f9c46a2 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -8,7 +8,8 @@ build ubuntu:
   script:
     - image_name="${CI_REGISTRY}/${CI_PROJECT_PATH,,}"
     - podman build --cgroup-manager=cgroupfs --pull -t "${image_name}/ubuntu" ubuntu
-    - podman build --cgroup-manager=cgroupfs -t "${image_name}/jupyterhub" jupyterhub
+    - podman build --cgroup-manager=cgroupfs -t "${image_name}/jupyterhub" jupyterhub/base
+    - podman build --cgroup-manager=cgroupfs -t "${image_name}/jupyterhub_vim" jupyterhub/vim
 
 deploy ubuntu:
   stage: deploy
@@ -25,5 +26,9 @@ deploy ubuntu:
     - podman push "${image_name}/jupyterhub:$calver"
     - podman image rm "${image_name}/jupyterhub:$calver"
     - docker pull "${image_name}/jupyterhub:$calver"
+    - podman tag "${image_name}/jupyterhub_vim" "${image_name}/jupyterhub_vim:$calver"
+    - podman push "${image_name}/jupyterhub_vim:$calver"
+    - podman image rm "${image_name}/jupyterhub_vim:$calver"
+    - docker pull "${image_name}/jupyterhub_vim:$calver"
   after_script:
     - podman logout "${CI_REGISTRY}"
diff --git a/jupyterhub/Dockerfile b/jupyterhub/base/Dockerfile
similarity index 61%
rename from jupyterhub/Dockerfile
rename to jupyterhub/base/Dockerfile
index 4986bdb..c78ff37 100755
--- a/jupyterhub/Dockerfile
+++ b/jupyterhub/base/Dockerfile
@@ -9,7 +9,7 @@ RUN apt-get update && \
         curl && \
     apt-get clean
 
-ARG PYTHON_VERSION=3.8
+ENV JUPYTERHUB_PYTHON_VERSION=3.8
 
 RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
     apt-get update && \
@@ -20,31 +20,31 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
         openjdk-11-jre-headless && \
     apt-get clean
 
-RUN python${PYTHON_VERSION} -m pip --no-cache-dir install \
+RUN python${JUPYTERHUB_PYTHON_VERSION} -m pip --no-cache-dir install \
         jupyterlab \
         jupyterhub \
         ipympl \
 	&& \
-    python${PYTHON_VERSION} -m jupyter labextension install \
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter labextension install \
         @jupyter-widgets/jupyterlab-manager && \
-    python${PYTHON_VERSION} -m jupyter serverextension enable --sys-prefix --py jupyterlab && \
-    python${PYTHON_VERSION} -m jupyter labextension install \
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter serverextension enable --sys-prefix --py jupyterlab && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter labextension install \
         jupyter-webrtc \
         ipyvolume \
         jupyter-threejs \
         jupyterlab-execute-time \
     && \
-    python${PYTHON_VERSION} -m jupyter labextension install @ryantam626/jupyterlab_code_formatter && \
-    python${PYTHON_VERSION} -m pip --no-cache-dir install jupyterlab_code_formatter && \
-    python${PYTHON_VERSION} -m jupyter serverextension enable --sys-prefix --py jupyterlab_code_formatter && \
-    python${PYTHON_VERSION} -m pip --no-cache-dir install black isort && \
-    python${PYTHON_VERSION} -m pip --no-cache-dir install jupyterlab-git && \
-    python${PYTHON_VERSION} -m jupyter lab build
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter labextension install @ryantam626/jupyterlab_code_formatter && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m pip --no-cache-dir install jupyterlab_code_formatter && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter serverextension enable --sys-prefix --py jupyterlab_code_formatter && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m pip --no-cache-dir install black isort && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m pip --no-cache-dir install jupyterlab-git && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m jupyter lab build
 
 RUN mkdir -p ~/.venv && \
-    python${PYTHON_VERSION} -m venv ~/.venv/robofish && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m venv ~/.venv/robofish && \
     . ~/.venv/robofish/bin/activate && \
-    python${PYTHON_VERSION} -m pip --no-cache-dir install --upgrade pip==20.2.2 && \
+    python${JUPYTERHUB_PYTHON_VERSION} -m pip --no-cache-dir install --upgrade pip==20.2.2 && \
     pip --no-cache-dir install --upgrade setuptools==49.1.0 && \
     pip install tensorflow==1.15.3 && \
     pip --no-cache-dir install \
diff --git a/jupyterhub/commands.jupyterlab-settings b/jupyterhub/base/commands.jupyterlab-settings
similarity index 100%
rename from jupyterhub/commands.jupyterlab-settings
rename to jupyterhub/base/commands.jupyterlab-settings
diff --git a/jupyterhub/jupyter_notebook_config.py b/jupyterhub/base/jupyter_notebook_config.py
similarity index 100%
rename from jupyterhub/jupyter_notebook_config.py
rename to jupyterhub/base/jupyter_notebook_config.py
diff --git a/jupyterhub/themes.jupyterlab-settings b/jupyterhub/base/themes.jupyterlab-settings
similarity index 100%
rename from jupyterhub/themes.jupyterlab-settings
rename to jupyterhub/base/themes.jupyterlab-settings
diff --git a/jupyterhub/vim/Dockerfile b/jupyterhub/vim/Dockerfile
new file mode 100755
index 0000000..b825dd9
--- /dev/null
+++ b/jupyterhub/vim/Dockerfile
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: Apache-2.0
+FROM git.imp.fu-berlin.de:5000/bioroboticslab/robofish/docker/jupyterhub
+
+LABEL maintainer="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"
+LABEL authors="Moritz Maxeiner <moritz.maxeiner@fu-berlin.de>"
+
+RUN python${JUPYTERHUB_PYTHON_VERSION} -m jupyter labextension install @axlair/jupyterlab_vim
-- 
GitLab