Skip to content

Commit fe330c7

Browse files
committed
Not working
1 parent 41279c8 commit fe330c7

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

jupyterhub/Dockerfile.jupyterhub

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
ARG JUPYTERHUB_VERSION
2-
FROM quay.io/jupyterhub/jupyterhub:$JUPYTERHUB_VERSION
1+
FROM quay.io/jupyterhub/jupyterhub:latest
32

43
# Install dockerspawner,
54
# hadolint ignore=DL3013

jupyterhub/Dockerfile.jupyterlab

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ RUN pip install --no-cache-dir \
1919
requests \
2020
pyclowder \
2121
pandas
22+
23+
# Copy Clowder API notebook
24+
COPY Clowder_APIs.ipynb /etc/jupyter/Clowder_APIs.ipynb

jupyterhub/jupyterhub_config.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Copyright (c) Jupyter Development Team.
22
# Distributed under the terms of the Modified BSD License.
33

4+
45
# Configuration file for JupyterHub
56
import os
67
import shutil
7-
import logging
88

99
from customauthenticator.custom import CustomTokenAuthenticator
1010

@@ -31,11 +31,13 @@
3131
# We follow the same convention.
3232
notebook_dir = os.environ.get("DOCKER_NOTEBOOK_DIR", "/home/jovyan/work")
3333
c.DockerSpawner.notebook_dir = notebook_dir
34+
c.Spawner.args = ["--NotebookApp.default_url=/notebooks/Welcome.ipynb"]
3435

3536
# Mount the real user's Docker volume on the host to the notebook user's
3637
# notebook directory in the container
3738
c.DockerSpawner.volumes = {"jupyterhub-user-{username}": notebook_dir}
3839

40+
3941
# Remove containers once they are stopped
4042
c.DockerSpawner.remove = True
4143

@@ -104,10 +106,14 @@
104106

105107

106108
# Pre spawn hook
107-
# def pre_spawn_hook(spawner):
108-
# # Git clone
109-
#
110-
#
109+
def post_spawn_hook(spawner, auth_state):
110+
username = spawner.user.name
111+
spawner.environment["GREETING"] = f"Hello Master {username}"
112+
113+
target_file_path = f"/home/jovyan/work/Clowder_APIs.ipynb"
114+
115+
if not os.path.exists(target_file_path):
116+
shutil.copy2("/etc/jupyter/Clowder_APIs.ipynb", target_file_path)
111117

112118

113-
# c.Spawner.post_stop_hook = pre_spawn_hook
119+
# c.Spawner.auth_state_hook = post_spawn_hook

0 commit comments

Comments
 (0)