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
3
2
4
3
# Install dockerspawner,
5
4
# hadolint ignore=DL3013
Original file line number Diff line number Diff line change @@ -19,3 +19,6 @@ RUN pip install --no-cache-dir \
19
19
requests \
20
20
pyclowder \
21
21
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 1
1
# Copyright (c) Jupyter Development Team.
2
2
# Distributed under the terms of the Modified BSD License.
3
3
4
+
4
5
# Configuration file for JupyterHub
5
6
import os
6
7
import shutil
7
- import logging
8
8
9
9
from customauthenticator .custom import CustomTokenAuthenticator
10
10
31
31
# We follow the same convention.
32
32
notebook_dir = os .environ .get ("DOCKER_NOTEBOOK_DIR" , "/home/jovyan/work" )
33
33
c .DockerSpawner .notebook_dir = notebook_dir
34
+ c .Spawner .args = ["--NotebookApp.default_url=/notebooks/Welcome.ipynb" ]
34
35
35
36
# Mount the real user's Docker volume on the host to the notebook user's
36
37
# notebook directory in the container
37
38
c .DockerSpawner .volumes = {"jupyterhub-user-{username}" : notebook_dir }
38
39
40
+
39
41
# Remove containers once they are stopped
40
42
c .DockerSpawner .remove = True
41
43
104
106
105
107
106
108
# 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 )
111
117
112
118
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