forked from mmgaggle/s2i-openvino-notebook
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-notebook.sh
executable file
·68 lines (53 loc) · 2.02 KB
/
start-notebook.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -x
set -eo pipefail
if [[ ! -z "${JUPYTER_ENABLE_KERNELGATEWAY}" ]]; then
exec /opt/app-root/bin/start-kernelgateway.sh "$@"
fi
if [ x"$JUPYTER_MASTER_FILES" != x"" ]; then
if [ x"$JUPYTER_WORKSPACE_NAME" != x"" ]; then
JUPYTER_WORKSPACE_PATH=/opt/app-root/src/$JUPYTER_WORKSPACE_NAME
setup-volume.sh $JUPYTER_MASTER_FILES $JUPYTER_WORKSPACE_PATH
fi
fi
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS $NOTEBOOK_ARGS"
JUPYTER_NOTEBOOK_INTERFACE=${JUPYTER_NOTEBOOK_INTERFACE:-classic}
if [ x"$JUPYTER_ENABLE_LAB" = x"" ]; then
if [ x"$JUPYTER_NOTEBOOK_INTERFACE" = x"lab" ]; then
JUPYTER_ENABLE_LAB=true
fi
fi
JUPYTER_ENABLE_LAB=`echo "$JUPYTER_ENABLE_LAB" | tr '[A-Z]' '[a-z]'`
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --NotebookApp.default_url=/lab"
else
if [ x"$JUPYTER_WORKSPACE_NAME" != x"" ]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --NotebookApp.default_url=/tree/$JUPYTER_WORKSPACE_NAME"
fi
fi
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --config=/opt/app-root/etc/jupyter_server_config.py"
else
JUPYTER_PROGRAM_ARGS="$JUPYTER_PROGRAM_ARGS --config=/opt/app-root/etc/jupyter_notebook_config.py"
fi
if [[ "$JUPYTER_PROGRAM_ARGS $@" != *"--ip="* ]]; then
JUPYTER_PROGRAM_ARGS="--ip=0.0.0.0 $JUPYTER_PROGRAM_ARGS"
fi
if [[ ! -z "${JUPYTERHUB_API_TOKEN}" ]]; then
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM="jupyter labhub"
else
JUPYTER_PROGRAM="jupyterhub-singleuser"
fi
else
if [[ "$JUPYTER_ENABLE_LAB" =~ ^(true|yes|y|1)$ ]]; then
JUPYTER_PROGRAM="jupyter lab"
else
JUPYTER_PROGRAM="jupyter notebook"
fi
fi
. /opt/app-root/bin/setup-environ.sh
if [ -f /opt/app-root/src/.jupyter/jupyter_notebook_config.sh ]; then
. /opt/app-root/src/.jupyter/jupyter_notebook_config.sh
fi
exec /opt/app-root/bin/start.sh $JUPYTER_PROGRAM $JUPYTER_PROGRAM_ARGS "$@"