File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 11# Copyright (c) Jupyter Development Team.
22# Distributed under the terms of the Modified BSD License.
33
4+
45# Configuration file for JupyterHub
56import os
67import shutil
7- import logging
88
99from customauthenticator .custom import CustomTokenAuthenticator
1010
3131# We follow the same convention.
3232notebook_dir = os .environ .get ("DOCKER_NOTEBOOK_DIR" , "/home/jovyan/work" )
3333c .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
3738c .DockerSpawner .volumes = {"jupyterhub-user-{username}" : notebook_dir }
3839
40+
3941# Remove containers once they are stopped
4042c .DockerSpawner .remove = True
4143
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
You can’t perform that action at this time.
0 commit comments