From e8dc2464fcb6ede85b936503e70e7452f1312264 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Sun, 14 May 2023 12:13:32 +0900 Subject: [PATCH 1/3] Fix jupyter-lab script --- Dockerfile | 7 +++++-- conf/bin/jupyter-lab | 5 +++++ conf/bin/jupyter-notebook | 30 +----------------------------- conf/bin/run-hook.sh | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 31 deletions(-) create mode 100644 conf/bin/jupyter-lab create mode 100644 conf/bin/run-hook.sh diff --git a/Dockerfile b/Dockerfile index cec430b..f376fd4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,8 +49,11 @@ RUN mkdir -p /usr/local/bin/before-notebook.d && \ RUN mkdir -p /opt/jupyter-with-jenkins/original/bin/ && \ mv /opt/conda/bin/jupyterhub-singleuser /opt/jupyter-with-jenkins/original/bin/jupyterhub-singleuser && \ mv /opt/conda/bin/jupyter-notebook /opt/jupyter-with-jenkins/original/bin/jupyter-notebook && \ - cp /tmp/resource/conf/bin/* /opt/conda/bin/ && \ - chmod +x /opt/conda/bin/jupyterhub-singleuser /opt/conda/bin/jupyter-notebook + mv /opt/conda/bin/jupyter-lab /opt/jupyter-with-jenkins/original/bin/jupyter-lab && \ + cp /tmp/resource/conf/bin/jupyter* /opt/conda/bin/ && \ + cp /tmp/resource/conf/bin/*.sh /opt/jupyter-with-jenkins/bin/ && \ + chmod +x /opt/conda/bin/jupyterhub-singleuser /opt/conda/bin/jupyter-notebook /opt/conda/bin/jupyter-lab \ + /opt/jupyter-with-jenkins/bin/* # Configuration for Server Proxy RUN cat /tmp/resource/conf/jupyter_notebook_config.py >> $CONDA_DIR/etc/jupyter/jupyter_notebook_config.py diff --git a/conf/bin/jupyter-lab b/conf/bin/jupyter-lab new file mode 100644 index 0000000..f2d0d9d --- /dev/null +++ b/conf/bin/jupyter-lab @@ -0,0 +1,5 @@ +#!/bin/bash + +/opt/jupyter-with-jenkins/bin/run-hook.sh + +/opt/jupyter-with-jenkins/original/bin/jupyter-lab $@ diff --git a/conf/bin/jupyter-notebook b/conf/bin/jupyter-notebook index db977f4..33a48b6 100644 --- a/conf/bin/jupyter-notebook +++ b/conf/bin/jupyter-notebook @@ -2,34 +2,6 @@ set -xe -run-hooks () { - # Source scripts or run executable files in a directory - if [[ ! -d "$1" ]] ; then - return - fi - echo "$0: running hooks in $1" - for f in "$1/"*; do - case "$f" in - *.sh) - echo "$0: running $f" - source "$f" - ;; - *) - if [[ -x "$f" ]] ; then - echo "$0: running $f" - "$f" - else - echo "$0: ignoring $f" - fi - ;; - esac - done - echo "$0: done running hooks in $1" -} - -if [[ -z "${SUPERVISOR_INITIALIZED}" ]]; then - run-hooks /usr/local/bin/start-notebook.d - run-hooks /usr/local/bin/before-notebook.d -fi +/opt/jupyter-with-jenkins/bin/run-hook.sh /opt/jupyter-with-jenkins/original/bin/jupyter-notebook $@ diff --git a/conf/bin/run-hook.sh b/conf/bin/run-hook.sh new file mode 100644 index 0000000..7344c7a --- /dev/null +++ b/conf/bin/run-hook.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -xe + +run-hooks () { + # Source scripts or run executable files in a directory + if [[ ! -d "$1" ]] ; then + return + fi + echo "$0: running hooks in $1" + for f in "$1/"*; do + case "$f" in + *.sh) + echo "$0: running $f" + source "$f" + ;; + *) + if [[ -x "$f" ]] ; then + echo "$0: running $f" + "$f" + else + echo "$0: ignoring $f" + fi + ;; + esac + done + echo "$0: done running hooks in $1" +} + +if [[ -z "${SUPERVISOR_INITIALIZED}" ]]; then + run-hooks /usr/local/bin/start-notebook.d + run-hooks /usr/local/bin/before-notebook.d +fi From 17558c7f1e8515392e51f9b7f28bf78298390a28 Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Sun, 14 May 2023 12:17:25 +0900 Subject: [PATCH 2/3] Fix missing directory --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index f376fd4..d701d43 100644 --- a/Dockerfile +++ b/Dockerfile @@ -47,6 +47,7 @@ RUN mkdir -p /usr/local/bin/before-notebook.d && \ # Boot scripts to perform /usr/local/bin/before-notebook.d/* on JupyterHub RUN mkdir -p /opt/jupyter-with-jenkins/original/bin/ && \ + mkdir -p /opt/jupyter-with-jenkins/bin/ && \ mv /opt/conda/bin/jupyterhub-singleuser /opt/jupyter-with-jenkins/original/bin/jupyterhub-singleuser && \ mv /opt/conda/bin/jupyter-notebook /opt/jupyter-with-jenkins/original/bin/jupyter-notebook && \ mv /opt/conda/bin/jupyter-lab /opt/jupyter-with-jenkins/original/bin/jupyter-lab && \ From c9318273ab65d6d6f3f6cb97c14822f07a078a9a Mon Sep 17 00:00:00 2001 From: yacchin1205 <968739+yacchin1205@users.noreply.github.com> Date: Sun, 14 May 2023 12:24:09 +0900 Subject: [PATCH 3/3] Fix jupyter-lab --- conf/bin/jupyter-lab | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conf/bin/jupyter-lab b/conf/bin/jupyter-lab index f2d0d9d..5763520 100644 --- a/conf/bin/jupyter-lab +++ b/conf/bin/jupyter-lab @@ -1,5 +1,7 @@ #!/bin/bash +set -xe + /opt/jupyter-with-jenkins/bin/run-hook.sh /opt/jupyter-with-jenkins/original/bin/jupyter-lab $@