Skip to content

Commit

Permalink
Merge pull request #9 from yacchin1205/fix/mybinder
Browse files Browse the repository at this point in the history
Fixed Jenkins not working on mybinder
  • Loading branch information
yacchin1205 authored May 14, 2023
2 parents 6354997 + c931827 commit 6e86eb4
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 31 deletions.
8 changes: 6 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,14 @@ 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 && \
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
Expand Down
7 changes: 7 additions & 0 deletions conf/bin/jupyter-lab
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -xe

/opt/jupyter-with-jenkins/bin/run-hook.sh

/opt/jupyter-with-jenkins/original/bin/jupyter-lab $@
30 changes: 1 addition & 29 deletions conf/bin/jupyter-notebook
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
33 changes: 33 additions & 0 deletions conf/bin/run-hook.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6e86eb4

Please sign in to comment.