From fd2f0abac320ea680787ccb711b4fb8673b7a9e3 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 20:53:22 +0800 Subject: [PATCH 1/9] update Dockerfiles --- docker_app_clash/Dockerfile | 3 ++- docker_casdoor/Dockerfile | 6 +++-- docker_dev_box/Dockerfile | 26 ++++++++++---------- docker_dev_box/hub.Dockerfile | 5 ++-- docker_dev_box/work/script-devbox-jupyter.sh | 2 +- docker_keycloak/Dockerfile | 4 +-- docker_openresty/Dockerfile | 3 ++- 7 files changed, 27 insertions(+), 22 deletions(-) diff --git a/docker_app_clash/Dockerfile b/docker_app_clash/Dockerfile index 32bbfe3..bc789d9 100644 --- a/docker_app_clash/Dockerfile +++ b/docker_app_clash/Dockerfile @@ -2,7 +2,8 @@ FROM alpine AS builder # https://github.com/haishanh/yacd WORKDIR /tmp -RUN wget https://github.com/haishanh/yacd/archive/gh-pages.zip \ +RUN set -eux \ + && wget https://github.com/haishanh/yacd/archive/gh-pages.zip \ && unzip ./*.zip && rm -rf *.zip \ && mv ./* ./ui diff --git a/docker_casdoor/Dockerfile b/docker_casdoor/Dockerfile index 665d942..6fa2838 100644 --- a/docker_casdoor/Dockerfile +++ b/docker_casdoor/Dockerfile @@ -6,14 +6,16 @@ ARG BASE_IMG="node" FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG_BUILD} as builder COPY work /opt/utils/ -RUN source /opt/utils/script-setup-casdoor.sh \ +RUN set -eux \ + && source /opt/utils/script-setup-casdoor.sh \ && setup_casdoor FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} COPY --from=builder /opt/casdoor /opt/casdoor COPY work/app.conf /opt/casdoor/conf/app.conf -RUN mkdir -pv /root/web && ln -sf /opt/casdoor/web/build /root/web/ +RUN set -eux \ + && mkdir -pv /root/web && ln -sf /opt/casdoor/web/build /root/web/ LABEL maintainer="haobibo@gmail.com" ENV RUNNING_IN_DOCKER true diff --git a/docker_dev_box/Dockerfile b/docker_dev_box/Dockerfile index c849027..eea028c 100644 --- a/docker_dev_box/Dockerfile +++ b/docker_dev_box/Dockerfile @@ -16,22 +16,22 @@ ARG ARG_KEEP_NODEJS=true COPY work /opt/utils/ -# Setup Jupyter: Basic Configurations and Extensions -RUN mkdir -pv /opt/conda/etc/jupyter/ \ +RUN set -eux && source /opt/utils/script-utils.sh \ + # Setup Jupyter: Basic Configurations and Extensions + && mkdir -pv /opt/conda/etc/jupyter/ \ && mv /opt/utils/etc_jupyter/* /opt/conda/etc/jupyter/ && rm -rf /opt/utils/etc_jupyter \ && mv /opt/utils/start-*.sh /usr/local/bin/ && chmod +x /usr/local/bin/start-*.sh \ && source /opt/utils/script-devbox-jupyter.sh \ - && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} || true ) ; done - -# If not keeping NodeJS, remove NoedJS to reduce image size -RUN ${ARG_KEEP_NODEJS:-true} || ( echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ) - -# If installing coder-server # https://github.com/cdr/code-server/releases -RUN source /opt/utils/script-devbox-vscode.sh \ - && for profile in $(echo $ARG_PROFILE_VSCODE | tr "," "\n") ; do ( setup_vscode_${profile} || true ) ; done - -# Clean up and display components version information... -RUN source /opt/utils/script-utils.sh && install__clean && list_installed_packages + && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} || true ) ; done \ + # If installing coder-server # https://github.com/cdr/code-server/releases + && source /opt/utils/script-devbox-vscode.sh \ + && for profile in $(echo $ARG_PROFILE_VSCODE | tr "," "\n") ; do ( setup_vscode_${profile} || true ) ; done \ + # If not keeping NodeJS, remove NoedJS to reduce image size + && ${ARG_KEEP_NODEJS:-true} || ( \ + echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node \ + ) \ + # Clean up and display components version information... + && install__clean && list_installed_packages ENTRYPOINT ["tini", "-g", "--"] diff --git a/docker_dev_box/hub.Dockerfile b/docker_dev_box/hub.Dockerfile index ed5950a..9c17972 100644 --- a/docker_dev_box/hub.Dockerfile +++ b/docker_dev_box/hub.Dockerfile @@ -13,8 +13,9 @@ ARG ARG_KEEP_NODEJS=true COPY work /opt/utils/ -# Setup JupyterHub -RUN source /opt/utils/script-devbox-jupyter.sh \ +RUN set -eux \ + # Setup JupyterHub + && source /opt/utils/script-devbox-jupyter.sh \ && mv /opt/utils/start-*.sh /usr/local/bin/ && chmod +x /usr/local/bin/start-*.sh \ && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} || true ) ; done \ # If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index 0e230c9..6832674 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -84,7 +84,7 @@ setup_jupyter_extensions() { setup_jupyter_hub() { # ref1: https://github.com/jupyterhub/jupyterhub # ref2: https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile - which npm && npm install -g npm configurable-http-proxy + which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) pip install -Uq oauthenticator jupyterhub-ldapauthenticator jupyterhub-kerberosauthenticator \ && pip install -Uq dockerspawner jupyterhub-kubespawner jupyterhub-systemdspawner wrapspawner \ diff --git a/docker_keycloak/Dockerfile b/docker_keycloak/Dockerfile index f69fc6f..b76d4ae 100644 --- a/docker_keycloak/Dockerfile +++ b/docker_keycloak/Dockerfile @@ -8,8 +8,8 @@ LABEL maintainer="haobibo@gmail.com" COPY work /opt/utils/ -RUN source /opt/utils/script-setup-keycloak.sh \ - && setup_keycloak \ +RUN set -eux \ + && source /opt/utils/script-setup-keycloak.sh && setup_keycloak \ && echo "keycloak:x:0:root" >> /etc/group \ && echo "keycloak:x:1000:0:keycloak user:/opt/keycloak:/sbin/nologin" >> /etc/passwd \ && chown -R 1000:0 /opt/keycloak diff --git a/docker_openresty/Dockerfile b/docker_openresty/Dockerfile index 5ccabda..2b5fa0f 100644 --- a/docker_openresty/Dockerfile +++ b/docker_openresty/Dockerfile @@ -8,7 +8,8 @@ LABEL maintainer="haobibo@gmail.com" COPY work /opt/utils/ -RUN source /opt/utils/script-utils.sh && install_apt /opt/utils/install_list_openresty.apt \ +RUN set -eux \ + && source /opt/utils/script-utils.sh && install_apt /opt/utils/install_list_openresty.apt \ && source /opt/utils/script-setup.sh && setup_lua_base && setup_lua_rocks \ && source /opt/utils/script-setup-openresty.sh && setup_openresty \ && source /opt/utils/script-setup-acme.sh && setup_acme \ From 3774b778dd0c96aff918d8be7962df98d363475a Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 21:01:42 +0800 Subject: [PATCH 2/9] fix in build --- .github/workflows/build-docker.yml | 6 +++--- docker_casdoor/Dockerfile | 4 ++-- docker_dev_box/{Dockerfile => dev.Dockerfile} | 0 docker_keycloak/Dockerfile | 2 +- docker_openresty/Dockerfile | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) rename docker_dev_box/{Dockerfile => dev.Dockerfile} (100%) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 6b8d0da..832663f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -85,7 +85,7 @@ jobs: - uses: actions/checkout@v4 - run: | source ./tool.sh && free_diskspace - build_image base-dev latest docker_dev_box/Dockerfile \ + build_image base-dev latest docker_dev_box/dev.Dockerfile \ --build-arg "BASE_IMG=node" \ --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ --build-arg "ARG_PROFILE_VSCODE=base" @@ -98,7 +98,7 @@ jobs: - uses: actions/checkout@v4 - run: | source ./tool.sh && free_diskspace - build_image data-science-dev latest docker_dev_box/Dockerfile \ + build_image data-science-dev latest docker_dev_box/dev.Dockerfile \ --build-arg "BASE_IMG=data-science-stack" \ --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ --build-arg "ARG_PROFILE_VSCODE=base" @@ -111,7 +111,7 @@ jobs: - uses: actions/checkout@v4 - run: | source ./tool.sh && free_diskspace - build_image cuda-dev latest docker_dev_box/Dockerfile \ + build_image cuda-dev latest docker_dev_box/dev.Dockerfile \ --build-arg "BASE_IMG=core-cuda" \ --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ --build-arg "ARG_PROFILE_VSCODE=base" diff --git a/docker_casdoor/Dockerfile b/docker_casdoor/Dockerfile index 6fa2838..771955d 100644 --- a/docker_casdoor/Dockerfile +++ b/docker_casdoor/Dockerfile @@ -6,7 +6,7 @@ ARG BASE_IMG="node" FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG_BUILD} as builder COPY work /opt/utils/ -RUN set -eux \ +RUN set -ex \ && source /opt/utils/script-setup-casdoor.sh \ && setup_casdoor @@ -14,7 +14,7 @@ RUN set -eux \ FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} COPY --from=builder /opt/casdoor /opt/casdoor COPY work/app.conf /opt/casdoor/conf/app.conf -RUN set -eux \ +RUN set -ex \ && mkdir -pv /root/web && ln -sf /opt/casdoor/web/build /root/web/ LABEL maintainer="haobibo@gmail.com" diff --git a/docker_dev_box/Dockerfile b/docker_dev_box/dev.Dockerfile similarity index 100% rename from docker_dev_box/Dockerfile rename to docker_dev_box/dev.Dockerfile diff --git a/docker_keycloak/Dockerfile b/docker_keycloak/Dockerfile index b76d4ae..7866036 100644 --- a/docker_keycloak/Dockerfile +++ b/docker_keycloak/Dockerfile @@ -8,7 +8,7 @@ LABEL maintainer="haobibo@gmail.com" COPY work /opt/utils/ -RUN set -eux \ +RUN set -ex \ && source /opt/utils/script-setup-keycloak.sh && setup_keycloak \ && echo "keycloak:x:0:root" >> /etc/group \ && echo "keycloak:x:1000:0:keycloak user:/opt/keycloak:/sbin/nologin" >> /etc/passwd \ diff --git a/docker_openresty/Dockerfile b/docker_openresty/Dockerfile index 2b5fa0f..25ba776 100644 --- a/docker_openresty/Dockerfile +++ b/docker_openresty/Dockerfile @@ -8,7 +8,7 @@ LABEL maintainer="haobibo@gmail.com" COPY work /opt/utils/ -RUN set -eux \ +RUN set -ex \ && source /opt/utils/script-utils.sh && install_apt /opt/utils/install_list_openresty.apt \ && source /opt/utils/script-setup.sh && setup_lua_base && setup_lua_rocks \ && source /opt/utils/script-setup-openresty.sh && setup_openresty \ From 847dc0dd0d73ab5f0f4d01348c990add8ea12cf3 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 21:24:26 +0800 Subject: [PATCH 3/9] add jpy pkgs --- docker_dev_box/work/install_list_JPY_extend.pip | 4 +++- docker_dev_box/work/script-devbox-jupyter.sh | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docker_dev_box/work/install_list_JPY_extend.pip b/docker_dev_box/work/install_list_JPY_extend.pip index 9315570..62dbf18 100644 --- a/docker_dev_box/work/install_list_JPY_extend.pip +++ b/docker_dev_box/work/install_list_JPY_extend.pip @@ -2,9 +2,11 @@ % Use percent char as line comment separator. ipyparallel % https://github.com/ipython/ipyparallel +jupytext % https://github.com/mwouts/jupytext ipynb % https://github.com/ipython/ipynb -jupyter-resource-usage % https://github.com/jupyter-server/jupyter-resource-usage jupyterlab_server[openapi] % https://github.com/jupyterlab/jupyterlab_server +jupyter-resource-usage % https://github.com/jupyter-server/jupyter-resource-usage +jupyterlab_rise % https://github.com/jupyterlab-contrib/rise jupyterlab-git % https://github.com/jupyterlab/jupyterlab-git % jupyter-collaboration % https://github.com/jupyterlab/jupyter-collaboration % jupyterlab-latex % bug on pypi version: https://github.com/jupyterlab/jupyterlab-latex diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index 6832674..789cd47 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -26,6 +26,7 @@ setup_jupyter_kernels() { # && /opt/node/bin/ijsinstall --install=global --spec-path=full \ # && mv /usr/local/share/jupyter/kernels/javascript /opt/conda/share/jupyter/kernels/ + ## alternative: https://github.com/jupyter-xeus/xeus-r ## checked @ 2024-0307 # TODO: help func requries proxy which R \ && echo "@ Install Jupyter Kernel for R: https://github.com/melff/RKernel" \ From f8c594aae1236cf9172fec593495ec206ab775ef Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 14:49:49 +0000 Subject: [PATCH 4/9] fix jupyter kernels --- docker_dev_box/README.md | 15 +++++++++- .../work/install_list_JPY_extend.pip | 1 + docker_dev_box/work/script-devbox-jupyter.sh | 30 ++++++++++++------- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/docker_dev_box/README.md b/docker_dev_box/README.md index 2cd264e..21bc22d 100644 --- a/docker_dev_box/README.md +++ b/docker_dev_box/README.md @@ -2,7 +2,7 @@ ## Develop and Debug - Single User -```bash +```shell IMG="qpod/developer" # IMG="registry.cn-hangzhou.aliyuncs.com/qpod/full-stack-dev" @@ -16,3 +16,16 @@ docker run -d --restart=always \ sleep 5s && docker logs QPod-lab-dev 2>&1|grep token= ``` + +Debug building: + +```shell +IMG="qpod/rust" +docker run --rm -it \ + --name=QPod-lab-dev --hostname=QPod \ + -p 18888-18890:8888-8890 \ + -v $(pwd):/root/ -w /root/ \ + $IMG bash + +docker exec -it QPod-lab-dev bash +``` diff --git a/docker_dev_box/work/install_list_JPY_extend.pip b/docker_dev_box/work/install_list_JPY_extend.pip index 62dbf18..0746384 100644 --- a/docker_dev_box/work/install_list_JPY_extend.pip +++ b/docker_dev_box/work/install_list_JPY_extend.pip @@ -8,5 +8,6 @@ jupyterlab_server[openapi] % https://github.com/jupyterlab/jupyterl jupyter-resource-usage % https://github.com/jupyter-server/jupyter-resource-usage jupyterlab_rise % https://github.com/jupyterlab-contrib/rise jupyterlab-git % https://github.com/jupyterlab/jupyterlab-git +jupyterlab-language-pack-zh-CN % language pack: https://github.com/jupyterlab/language-packs/tree/main/language-packs/jupyterlab-language-pack-zh-CN % jupyter-collaboration % https://github.com/jupyterlab/jupyter-collaboration % jupyterlab-latex % bug on pypi version: https://github.com/jupyterlab/jupyterlab-latex diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index 789cd47..da6df88 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -11,7 +11,7 @@ setup_jupyter_base() { setup_jupyter_kernels() { - echo "@ Jupyter Kernels RefList: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels" + echo "@ Jupyter Kernels RefList: https://github.com/jupyter/jupyter/wiki/Jupyter-kernels" echo "@ Install Jupyter Kernel for Bash" \ && pip install -Uq bash_kernel && python -m bash_kernel.install --sys-prefix @@ -44,25 +44,33 @@ setup_jupyter_kernels() { && $GOPATH/bin/gonb --install \ && mv ~/.local/share/jupyter/kernels/gonb /opt/conda/share/jupyter/kernels/ - ## TODO: buggy, cargo install sccache + ## checked @ 2024-0614 which rustc \ - && echo "@ Install Jupyter Kernel for Rust: https://github.com/evcxr/evcxr/issues/140" \ - && cargo install --locked evcxr_jupyter \ - && evcxr_jupyter --install --sys-prefix \ + && echo "@ Install Jupyter Kernel for Rust: https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/README.md" \ + # alternative approaches to install evxcr_jupyter: + # && cargo install --locked evcxr_jupyter \ + && VER_EVCXR=$(curl -sL https://github.com/evcxr/evcxr/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' ) \ + && URL_EVCXR="https://github.com/evcxr/evcxr/releases/download/v${VER_EVCXR}/evcxr_jupyter-v${VER_EVCXR}-x86_64-unknown-linux-gnu.tar.gz" \ + && echo "Downloading evcxr version ${VER_EVCXR} from: ${URL_EVCXR}" \ + && install_tar_gz $URL_EVCXR && mv /opt/evcxr* /tmp/evcxr && mv /tmp/evcxr/evcxr_jupyter /opt/cargo/bin/ \ + && /opt/cargo/bin/evcxr_jupyter --install --sys-prefix \ && mv ~/.local/share/jupyter/kernels/rust /opt/conda/share/jupyter/kernels/ - ## TODO: buggy - which java \ - && pip install -Uq pandas py4j - #&& pip install beakerx && beakerx install \ - #&& jupyter labextension install beakerx-jupyterlab - ## checked @ 2024-0307 which julia \ && echo "@ Install Jupyter Kernel for Julia: https://github.com/JuliaLang/IJulia.jl" \ && julia -e "using Pkg; Pkg.add(\"IJulia\"); Pkg.precompile();" \ && mv ~/.local/share/jupyter/kernels/julia* /opt/conda/share/jupyter/kernels/ + ## Checked @ 2024-0614 + which java \ + && export JBANG_DIR=/opt/jbang \ + && echo "export JBANG_DIR=${JBANG_DIR}" > /etc/profile.d/path-jbang.sh \ + && curl -Ls https://sh.jbang.dev | bash -s - app setup \ + && jbang trust add https://github.com/jupyter-java \ + && jbang install-kernel@jupyter-java \ + && mv ~/.local/share/jupyter/kernels/jbang-* /opt/conda/share/jupyter/kernels/ + ## https://github.com/jupyter-xeus/xeus-octave # TODO: to check which octave \ && export PATH=/opt/octave/bin:$PATH \ From 2ec2179832b87785b4a883815a4298d87c8cd768 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 15:10:52 +0000 Subject: [PATCH 5/9] add full-stack --- .github/workflows/build-docker.yml | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 832663f..f02b0cd 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -73,9 +73,7 @@ jobs: steps: - uses: actions/checkout@v4 - run: | - source ./tool.sh - build_image openresty latest docker_openresty/Dockerfile - push_image + source ./tool.sh && build_image openresty latest docker_openresty/Dockerfile && push_image ## DevBox - base qpod_base-dev: @@ -90,7 +88,8 @@ jobs: --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ --build-arg "ARG_PROFILE_VSCODE=base" alias_image base-dev latest developer latest && push_image dev - ## DevBox - full stack + + ## DevBox - data science stack qpod_data-science-dev: name: 'data-science-dev' runs-on: ubuntu-latest @@ -103,6 +102,21 @@ jobs: --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ --build-arg "ARG_PROFILE_VSCODE=base" push_image + + ## DevBox - full stack + qpod_full-stack-dev: + name: 'full-stack-dev' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + source ./tool.sh && free_diskspace + build_image full-stack-dev latest docker_dev_box/dev.Dockerfile \ + --build-arg "BASE_IMG=full-stack" \ + --build-arg "ARG_PROFILE_JUPYTER=base,kernels,extensions" \ + --build-arg "ARG_PROFILE_VSCODE=base" + push_image + ## DevBox - cuda qpod_cuda-dev: name: 'full-cuda,cuda-dev' @@ -117,9 +131,10 @@ jobs: --build-arg "ARG_PROFILE_VSCODE=base" alias_image cuda-dev latest full-cuda latest && push_image + ## Sync all images in this build (listed by "names") to mirror registry. sync_images: - needs: ["qpod_cuda-dev"] + needs: ["qpod_cuda-dev", "qpod_full-stack-dev"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 400f69cdc61a46409555859903f6e20ee746e4f5 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 15:30:06 +0000 Subject: [PATCH 6/9] debug dockerfile ifs --- .github/workflows/build-docker.yml | 2 +- docker_dev_box/dev.Dockerfile | 8 +++++--- docker_dev_box/hub.Dockerfile | 10 ++++++---- docker_dev_box/work/script-devbox-jupyter.sh | 4 ++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index f02b0cd..dd4fa4f 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -134,7 +134,7 @@ jobs: ## Sync all images in this build (listed by "names") to mirror registry. sync_images: - needs: ["qpod_cuda-dev", "qpod_full-stack-dev"] + needs: ["qpod_cuda-dev", "qpod_data-science-dev", "qpod_full-stack-dev"] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/docker_dev_box/dev.Dockerfile b/docker_dev_box/dev.Dockerfile index eea028c..fa669f2 100644 --- a/docker_dev_box/dev.Dockerfile +++ b/docker_dev_box/dev.Dockerfile @@ -27,9 +27,11 @@ RUN set -eux && source /opt/utils/script-utils.sh \ && source /opt/utils/script-devbox-vscode.sh \ && for profile in $(echo $ARG_PROFILE_VSCODE | tr "," "\n") ; do ( setup_vscode_${profile} || true ) ; done \ # If not keeping NodeJS, remove NoedJS to reduce image size - && ${ARG_KEEP_NODEJS:-true} || ( \ - echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node \ - ) \ + && if [ ${ARG_KEEP_NODEJS} = "false" ] ; then \ + echo "Removing Node/NPM..." && rm -rf /usr/bin/node /usr/bin/npm /usr/bin/npx /opt/node ; \ + else \ + echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + fi \ # Clean up and display components version information... && install__clean && list_installed_packages diff --git a/docker_dev_box/hub.Dockerfile b/docker_dev_box/hub.Dockerfile index 9c17972..72e4d59 100644 --- a/docker_dev_box/hub.Dockerfile +++ b/docker_dev_box/hub.Dockerfile @@ -19,10 +19,12 @@ RUN set -eux \ && mv /opt/utils/start-*.sh /usr/local/bin/ && chmod +x /usr/local/bin/start-*.sh \ && for profile in $(echo $ARG_PROFILE_JUPYTER | tr "," "\n") ; do ( setup_jupyter_${profile} || true ) ; done \ # If not keeping NodeJS, remove NoedJS to reduce image size, and install Traefik instead - && ${ARG_KEEP_NODEJS:-true} || ( \ - 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.sh && setup_traefik \ - ) \ + && 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.sh && setup_traefik ; \ + else \ + echo "Keep NodeJS as ARG_KEEP_NODEJS defiend as: ${ARG_KEEP_NODEJS}" ; \ + fi \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean && list_installed_packages diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index da6df88..29a6cb2 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -45,10 +45,10 @@ setup_jupyter_kernels() { && mv ~/.local/share/jupyter/kernels/gonb /opt/conda/share/jupyter/kernels/ ## checked @ 2024-0614 - which rustc \ - && echo "@ Install Jupyter Kernel for Rust: https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/README.md" \ # alternative approaches to install evxcr_jupyter: # && cargo install --locked evcxr_jupyter \ + which rustc \ + && echo "@ Install Jupyter Kernel for Rust: https://github.com/evcxr/evcxr/blob/main/evcxr_jupyter/README.md" \ && VER_EVCXR=$(curl -sL https://github.com/evcxr/evcxr/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' ) \ && URL_EVCXR="https://github.com/evcxr/evcxr/releases/download/v${VER_EVCXR}/evcxr_jupyter-v${VER_EVCXR}-x86_64-unknown-linux-gnu.tar.gz" \ && echo "Downloading evcxr version ${VER_EVCXR} from: ${URL_EVCXR}" \ From 7d45470d1f0a291f20863ece278b6a0a61fe7d12 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 15:35:41 +0000 Subject: [PATCH 7/9] bugfix --- docker_dev_box/dev.Dockerfile | 2 +- docker_dev_box/hub.Dockerfile | 2 +- docker_dev_box/work/script-devbox-jupyter.sh | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker_dev_box/dev.Dockerfile b/docker_dev_box/dev.Dockerfile index fa669f2..c080cdd 100644 --- a/docker_dev_box/dev.Dockerfile +++ b/docker_dev_box/dev.Dockerfile @@ -16,7 +16,7 @@ ARG ARG_KEEP_NODEJS=true COPY work /opt/utils/ -RUN set -eux && source /opt/utils/script-utils.sh \ +RUN set -ex && source /opt/utils/script-utils.sh \ # Setup Jupyter: Basic Configurations and Extensions && mkdir -pv /opt/conda/etc/jupyter/ \ && mv /opt/utils/etc_jupyter/* /opt/conda/etc/jupyter/ && rm -rf /opt/utils/etc_jupyter \ diff --git a/docker_dev_box/hub.Dockerfile b/docker_dev_box/hub.Dockerfile index 72e4d59..7f390f7 100644 --- a/docker_dev_box/hub.Dockerfile +++ b/docker_dev_box/hub.Dockerfile @@ -13,7 +13,7 @@ ARG ARG_KEEP_NODEJS=true COPY work /opt/utils/ -RUN set -eux \ +RUN set -ex \ # Setup JupyterHub && source /opt/utils/script-devbox-jupyter.sh \ && mv /opt/utils/start-*.sh /usr/local/bin/ && chmod +x /usr/local/bin/start-*.sh \ diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index 29a6cb2..e4948cd 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -2,11 +2,10 @@ source /opt/utils/script-utils.sh setup_jupyter_base() { - pip install -Uq --pre jupyterhub jupyterlab notebook ipywidgets jupyter-server-proxy \ + pip install -Uq --pre jupyterlab notebook ipywidgets jupyter-server-proxy \ && echo "@ Version of Jupyter Server: $(jupyter server --version)" \ && echo "@ Version of Jupyter Lab: $(jupyter lab --version)" \ - && echo "@ Version of Jupyter Notebook: $(jupyter notebook --version)" \ - && echo "@ Version of JupyterHub: $(jupyterhub --version)" + && echo "@ Version of Jupyter Notebook: $(jupyter notebook --version)" } @@ -90,12 +89,13 @@ setup_jupyter_extensions() { } -setup_jupyter_hub() { +setup_jupyter_hub() { # ref1: https://github.com/jupyterhub/jupyterhub # ref2: https://github.com/jupyterhub/jupyterhub/blob/main/Dockerfile which npm && ( npm install -g npm configurable-http-proxy ) || ( echo "NPM not found!" && return 255 ) - pip install -Uq oauthenticator jupyterhub-ldapauthenticator jupyterhub-kerberosauthenticator \ + pip install -Uq --pre jupyterhub \ + && pip install -Uq oauthenticator jupyterhub-ldapauthenticator jupyterhub-kerberosauthenticator \ && pip install -Uq dockerspawner jupyterhub-kubespawner jupyterhub-systemdspawner wrapspawner \ && pip install -Uq psutil pycurl jupyter_client jupyterhub \ && pip install -Uq jupyterhub-traefik-proxy \ From 621308783330ef50fa91053b868cdb05ed7fe16c Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 16:17:39 +0000 Subject: [PATCH 8/9] fix JBANG --- docker_dev_box/work/script-devbox-jupyter.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index e4948cd..4df150a 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -6,6 +6,8 @@ setup_jupyter_base() { && echo "@ Version of Jupyter Server: $(jupyter server --version)" \ && echo "@ Version of Jupyter Lab: $(jupyter lab --version)" \ && echo "@ Version of Jupyter Notebook: $(jupyter notebook --version)" + + jupyter labextension disable "@jupyterlab/apputils-extension:announcements" } @@ -64,10 +66,11 @@ setup_jupyter_kernels() { ## Checked @ 2024-0614 which java \ && export JBANG_DIR=/opt/jbang \ - && echo "export JBANG_DIR=${JBANG_DIR}" > /etc/profile.d/path-jbang.sh \ + && echo "export JBANG_DIR=${JBANG_DIR}" > /etc/profile.d/path-jbang.sh \ + && echo 'export PATH=${PATH}:${JBANG_DIR}/bin' >> /etc/profile.d/path-jbang.sh \ && curl -Ls https://sh.jbang.dev | bash -s - app setup \ - && jbang trust add https://github.com/jupyter-java \ - && jbang install-kernel@jupyter-java \ + && ${JBANG_DIR}/bin/jbang trust add https://github.com/jupyter-java \ + && ${JBANG_DIR}/bin/jbang install-kernel@jupyter-java \ && mv ~/.local/share/jupyter/kernels/jbang-* /opt/conda/share/jupyter/kernels/ ## https://github.com/jupyter-xeus/xeus-octave # TODO: to check From 045915469f529e54aa23039f2684346cb51da147 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Fri, 14 Jun 2024 16:29:37 +0000 Subject: [PATCH 9/9] fix JBANG exe in PATH --- docker_dev_box/work/script-devbox-jupyter.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker_dev_box/work/script-devbox-jupyter.sh b/docker_dev_box/work/script-devbox-jupyter.sh index 4df150a..44c48ea 100644 --- a/docker_dev_box/work/script-devbox-jupyter.sh +++ b/docker_dev_box/work/script-devbox-jupyter.sh @@ -65,7 +65,7 @@ setup_jupyter_kernels() { ## Checked @ 2024-0614 which java \ - && export JBANG_DIR=/opt/jbang \ + && export JBANG_DIR=/opt/jbang && export PATH=${PATH}:${JBANG_DIR}/bin \ && echo "export JBANG_DIR=${JBANG_DIR}" > /etc/profile.d/path-jbang.sh \ && echo 'export PATH=${PATH}:${JBANG_DIR}/bin' >> /etc/profile.d/path-jbang.sh \ && curl -Ls https://sh.jbang.dev | bash -s - app setup \ @@ -86,8 +86,8 @@ setup_jupyter_extensions() { install_apt /opt/utils/install_list_JPY_extend.apt \ && install_pip /opt/utils/install_list_JPY_extend.pip - echo "@ Jupyter Server Extension list: " && jupyter server extension list \ - && echo "@ Jupyter Lab Extension list: " && jupyter labextension list \ + echo "@ Jupyter Server Extension list: " && jupyter server extension list \ + && echo "@ Jupyter Lab Extension list: " && jupyter labextension list \ && echo "@ Jupyter Notebook Extension list: " && jupyter notebook extension list }