From ec037309eae22eff416f9bf09b850983124f6374 Mon Sep 17 00:00:00 2001
From: Florian de Boissieu <fdeboiss@gmail.com>
Date: Fri, 30 Sep 2022 00:42:36 +0200
Subject: [PATCH] add jupyterhub config file as mounted volume

---
 TODO.md                                           | 1 -
 jupyterhub-minimal-notebook/docker-compose.yml    | 1 +
 jupyterhub-minimal-notebook/jupyterhub/Dockerfile | 3 ---
 jupyterhub-rstudio-gitlab/jupyterhub/Dockerfile   | 6 +-----
 jupyterhub-rstudio/docker-compose.yml             | 1 +
 jupyterhub-rstudio/jupyterhub/Dockerfile          | 3 ---
 6 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/TODO.md b/TODO.md
index ae15288..0274863 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,4 @@
 
-- Add jupyter_config.py as a volume in docker-compose.yml 
 - Add userlist as a bind volume and use it in jupyterhub_config.py
 - Add an ansible playbook to create users for the non-gitlab auth
 - Documentation of jupyterhub-rstudio and jupyterhub-rstudio-gitlab
diff --git a/jupyterhub-minimal-notebook/docker-compose.yml b/jupyterhub-minimal-notebook/docker-compose.yml
index c70a342..f633397 100644
--- a/jupyterhub-minimal-notebook/docker-compose.yml
+++ b/jupyterhub-minimal-notebook/docker-compose.yml
@@ -8,6 +8,7 @@ services:
     container_name: ${COMPOSE_PROJECT_NAME}_hub    # The service will use this container name.
     volumes:                         # Give access to Docker socket.
       - /var/run/docker.sock:/var/run/docker.sock
+      - ./jupyterhub/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
     environment:                     # Env variables passed to the Hub process.
       DOCKER_JUPYTER_IMAGE: jupyter/minimal-notebook
       DOCKER_NETWORK_NAME: ${COMPOSE_PROJECT_NAME}_default
diff --git a/jupyterhub-minimal-notebook/jupyterhub/Dockerfile b/jupyterhub-minimal-notebook/jupyterhub/Dockerfile
index 16084e2..54d7708 100644
--- a/jupyterhub-minimal-notebook/jupyterhub/Dockerfile
+++ b/jupyterhub-minimal-notebook/jupyterhub/Dockerfile
@@ -1,9 +1,6 @@
 # Do not forget to pin down the version
 FROM jupyterhub/jupyterhub:3.0.0
 
-# Copy the JupyterHub configuration in the container
-COPY jupyterhub_config.py .
-
 # Download script to automatically stop idle single-user servers
 # RUN wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/0.9.3/examples/cull-idle/cull_idle_servers.py
 
diff --git a/jupyterhub-rstudio-gitlab/jupyterhub/Dockerfile b/jupyterhub-rstudio-gitlab/jupyterhub/Dockerfile
index 0baf272..0bd8dcc 100644
--- a/jupyterhub-rstudio-gitlab/jupyterhub/Dockerfile
+++ b/jupyterhub-rstudio-gitlab/jupyterhub/Dockerfile
@@ -1,13 +1,9 @@
 # Do not forget to pin down the version
 FROM jupyterhub/jupyterhub:3.0.0
 
-# Copy the JupyterHub configuration in the container
-COPY jupyterhub_config.py .
-
 # Download script to automatically stop idle single-user servers
 # RUN wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/0.9.3/examples/cull-idle/cull_idle_servers.py
 
 # Install dependencies (for advanced authentication and spawning)
 RUN pip3 install --no-cache dockerspawner oauthenticator
-#    dockerspawner==0.10.0 \
-#    oauthenticator==0.8.0
+
diff --git a/jupyterhub-rstudio/docker-compose.yml b/jupyterhub-rstudio/docker-compose.yml
index 58fa012..2e11b6e 100644
--- a/jupyterhub-rstudio/docker-compose.yml
+++ b/jupyterhub-rstudio/docker-compose.yml
@@ -8,6 +8,7 @@ services:
     container_name: ${COMPOSE_PROJECT_NAME}_hub    # The service will use this container name.
     volumes:                         # Give access to Docker socket.
       - /var/run/docker.sock:/var/run/docker.sock
+      - ./jupyterhub/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
     environment:                     # Env variables passed to the Hub process.
       DOCKER_JUPYTER_IMAGE: rstudio_img
       DOCKER_NETWORK_NAME: ${COMPOSE_PROJECT_NAME}_default
diff --git a/jupyterhub-rstudio/jupyterhub/Dockerfile b/jupyterhub-rstudio/jupyterhub/Dockerfile
index 16084e2..54d7708 100644
--- a/jupyterhub-rstudio/jupyterhub/Dockerfile
+++ b/jupyterhub-rstudio/jupyterhub/Dockerfile
@@ -1,9 +1,6 @@
 # Do not forget to pin down the version
 FROM jupyterhub/jupyterhub:3.0.0
 
-# Copy the JupyterHub configuration in the container
-COPY jupyterhub_config.py .
-
 # Download script to automatically stop idle single-user servers
 # RUN wget https://raw.githubusercontent.com/jupyterhub/jupyterhub/0.9.3/examples/cull-idle/cull_idle_servers.py
 
-- 
GitLab