diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index d9b1943..fde4f6c 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -67,6 +67,19 @@ jobs: --build-arg "BASE_IMG=node" \ --build-arg "ARG_PROFILE_JUPYTER=hub" push_image dev-hub + + job-dev-hub-traefik: + name: "dev-hub-traefik" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + - run: | + source ./tool.sh + build_image dev-hub-traefik latest docker_devbox/hub.Dockerfile \ + --build-arg "BASE_IMG=base" \ + --build-arg "ARG_PROFILE_JUPYTER=hub" \ + --build-arg "ARG_KEEP_NODEJS=false" + push_image dev-hub-traefik ## OpenResty as gateway job-openresty: diff --git a/docker_devbox/hub.Dockerfile b/docker_devbox/hub.Dockerfile index 24df020..e052373 100644 --- a/docker_devbox/hub.Dockerfile +++ b/docker_devbox/hub.Dockerfile @@ -20,15 +20,21 @@ RUN set -eux \ && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} ) ; done \ ## If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead && if [ ${ARG_KEEP_NODEJS} = "false" ] ; then \ - echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \ - echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ + # Using Traefik to server as proxy, which is a modern HTTP reverse proxy and load balancer that makes deploying microservices easy. + echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \ + echo "Installing Traefik to server as proxy:" && source /opt/utils/script-setup-net.sh && setup_traefik ; \ else \ - echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + # Using NodeJS to install configurable-http-proxy, which is a dependency of JupyterHub, and also used as the default proxy for JupyterHub. + echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint ; \ + which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) ; \ + # Notes: there is also an python version of configurable-http-proxy available but has limited compatibility. + ln -sf $(which configurable-http-proxy) /usr/local/bin/configurable-http-proxy ; \ + type configurable-http-proxy && echo "@ Configurable HTTP Proxy version: $(configurable-http-proxy --version)" || return -1 ; \ fi \ ## network-tools https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/network-tools/Dockerfile && apt-get update && apt-get install -y --no-install-recommends \ iptables dnsutils libcurl4 libpq5 sqlite3 \ - && curl -fsSL -o /usr/local/bin/start-configurable-http-proxy.sh https://raw.githubusercontent.com/jupyterhub/configurable-http-proxy/refs/heads/main/chp-docker-entrypoint \ && mv /opt/utils/start-*.sh /usr/local/bin/ \ && chmod +x /usr/local/bin/start-*.sh \ ## Clean up and display components version information... diff --git a/docker_devbox/work/script-devbox-jupyter.sh b/docker_devbox/work/script-devbox-jupyter.sh index acc9da5..c85064d 100644 --- a/docker_devbox/work/script-devbox-jupyter.sh +++ b/docker_devbox/work/script-devbox-jupyter.sh @@ -103,8 +103,6 @@ setup_jupyter_hub() { # ref1: https://github.com/jupyterhub/jupyterhub # ref2: https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile # ref3: https://github.com/jupyterhub/zero-to-jupyterhub-k8s/blob/main/images/hub/unfrozen/requirements.txt - which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) ; - pip install -Uq --pre jupyterhub jupyter_client \ dockerspawner jupyterhub-kubespawner jupyterhub-systemdspawner wrapspawner \ jupyterhub-ldapauthenticator jupyterhub-kerberosauthenticator \ @@ -115,10 +113,5 @@ setup_jupyter_hub() { psutil pycurl py-spy \ jupyterhub-traefik-proxy ; - # Notes: there is also an python version of configurable-http-proxy available but has limited compatibility. - ln -sf $(which configurable-http-proxy) /usr/local/bin/configurable-http-proxy ; - - type configurable-http-proxy && echo "@ Configurable HTTP Proxy version: $(configurable-http-proxy --version)" || return -1 ; - type jupyterhub && echo "@ JupyterHub version: $(jupyterhub --version)" || return -1 ; }