@@ -68,7 +68,7 @@ def _is_port_in_use(self, port):
68
68
with socket .socket (socket .AF_INET , socket .SOCK_STREAM ) as s :
69
69
return s .connect_ex (('127.0.0.1' , port )) == 0
70
70
71
- def spawn_jupyter_hub (self ):
71
+ def spawn_jupyter_hub (self , jb_build_command = None ):
72
72
"""
73
73
Spawn a JupyterHub instance.
74
74
"""
@@ -77,6 +77,11 @@ def spawn_jupyter_hub(self):
77
77
h .update (os .urandom (20 ))
78
78
self .jh_token = h .hexdigest ()
79
79
80
+ if jb_build_command :
81
+ this_entrypoint = f"jupyter-book build --all --verbose --path-output { self .host_build_source_parent_dir } content 2>&1 | tee -a jupyter_book_build.log"
82
+ else :
83
+ this_entrypoint = f'jupyter server --allow-root --ip 0.0.0.0 --log-level=DEBUG --IdentityProvider.token="{ self .jh_token } " --ServerApp.port="{ self .port } "'
84
+
80
85
if not self .rees .search_img_by_repo_name ():
81
86
raise Exception (f"[ERROR] A docker image has not been found for { self .rees .gh_user_repo_name } at { self .rees .binder_image_tag } ." )
82
87
if self .rees .binder_image_tag not in self .rees .found_image_tags :
@@ -103,7 +108,7 @@ def spawn_jupyter_hub(self):
103
108
self .rees .docker_image ,
104
109
ports = {f'{ self .port } /tcp' : self .port },
105
110
environment = {"JUPYTER_TOKEN" : f'{ self .jh_token } ' ,"port" : f'{ self .port } ' ,"JUPYTER_BASE_URL" : f'{ self .jh_url } ' },
106
- entrypoint = f'jupyter server --allow-root --ip 0.0.0.0 --log-level=DEBUG --IdentityProvider.token=" { self . jh_token } " --ServerApp.port=" { self . port } "' ,
111
+ entrypoint = this_entrypoint ,
107
112
volumes = mnt_vol ,
108
113
detach = True )
109
114
logging .info (f'Jupyter hub is { self .container .status } ' )
0 commit comments