From e1cb64abf4d9c9f439b057c559b20347716324ee Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 18:42:50 +0800 Subject: [PATCH 1/7] update fns --- README.md | 3 -- docker_atom/work/script-setup-core.sh | 44 +++++++++++++-------------- docker_core/core.Dockerfile | 35 ++++++++++----------- docker_cuda/nvidia-cuda.Dockerfile | 2 +- tool.sh | 2 +- 5 files changed, 42 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index ef8a6b1..45ceab9 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,6 @@ [![Visit Images on DockerHub](https://img.shields.io/badge/DockerHub-Images-green)](https://hub.docker.com/u/LabNow) Please generously STAR★ our project or donate to us! [![GitHub Starts](https://img.shields.io/github/stars/LabNow-ai/lab-foundation.svg?label=Stars)](https://github.com/LabNow-ai/lab-foundation/stargazers) -[![Donate-PayPal](https://img.shields.io/badge/Donate-PayPal-blue.svg)](https://paypal.me/haobibo) -[![Donate-AliPay](https://img.shields.io/badge/Donate-Alipay-blue.svg)](https://raw.githubusercontent.com/wiki/haobibo/resources/img/Donate-AliPay.png) -[![Donate-WeChat](https://img.shields.io/badge/Donate-WeChat-green.svg)](https://raw.githubusercontent.com/wiki/haobibo/resources/img/Donate-WeChat.png) Discussion and contributions are welcome: [![Join the Discord Chat](https://img.shields.io/badge/Discuss_on-Discord-green)](https://discord.gg/kHUzgQxgbJ) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index 55d0565..9b2d8c2 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -155,16 +155,16 @@ setup_java_maven() { setup_node_base() { - local VER_NODEJS_MAJOR="${1-}" \ + local VER_NODEJS="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/aarch64/arm64/') \ && local ATOM_NODEJS=$(curl -sL https://github.com/nodejs/node/releases.atom | grep 'releases/tag' | sort -r) \ - && if [ -n "${VER_NODEJS_MAJOR}" ]; then - local VER_NODEJS=$(echo "${ATOM_NODEJS}" | grep -Po '\d[.\d]+' | grep -E "^${VER_NODEJS_MAJOR}\\." | head -1) - else - local VER_NODEJS=$(echo "${ATOM_NODEJS}" | head -1 | grep -Po '\d[.\d]+') - local VER_NODEJS_MAJOR=$(echo "${VER_NODEJS}" | cut -d '.' -f1) - fi \ + && case "${VER_NODEJS}" in + '') VER_NODEJS=$(echo "${ATOM_NODEJS}" | head -1 | grep -Po '\d[\.\d]+') ;; + *.*.*) ;; + *) VER_NODEJS=$(echo "${ATOM_NODEJS}" | grep -Po '\d[\.\d]+' | grep -E "^${VER_NODEJS}\\." | head -1) ;; + esac \ + && local VER_NODEJS_MAJOR=$(echo "${VER_NODEJS}" | cut -d '.' -f1) \ && local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS_MAJOR}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" \ && echo "Downloading NodeJS version ${VER_NODEJS} from: ${URL_NODEJS}" \ && install_tar_gz ${URL_NODEJS} \ @@ -217,15 +217,15 @@ setup_node_bun() { setup_GO() { - local VER_GO_MAJOR="${1-}" \ + local VER_GO="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(dpkg --print-architecture) \ - && local ATOM_GO=$(curl -sL https://github.com/golang/go/releases.atom | grep 'releases/tag' | grep -v 'rc' | sort -r ) \ - && if [ -n "${VER_GO_MAJOR}" ]; then - local VER_GO=$(echo "${ATOM_GO}" | grep -Po '\d[\d.]+' | grep -E "^${VER_GO_MAJOR}\\." | head -1) - else - local VER_GO=$(echo "${ATOM_GO}" | head -1 | grep -Po '\d[\d.]+') - fi \ + && local ATOM_GO=$(curl -sL https://github.com/golang/go/releases.atom | grep 'releases/tag' | grep -v 'rc' | sort -r) \ + && case "${VER_GO}" in + '') VER_GO=$(echo "${ATOM_GO}" | head -1 | grep -Po '\d[\d.]+') ;; + *.*.*) ;; + *) VER_GO=$(echo "${ATOM_GO}" | grep -Po '\d[\d.]+' | grep -E "^${VER_GO}\\." | head -1) ;; + esac \ && local URL_GO="https://dl.google.com/go/go${VER_GO}.${UNAME}-${ARCH}.tar.gz" \ && echo "Downloading golang version ${VER_GO} from: ${URL_GO}" \ && install_tar_gz "${URL_GO}" go \ @@ -270,17 +270,17 @@ setup_R_base() { setup_julia() { - local VER_JULIA_MAJOR="${1-}" \ + local VER_JULIA="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH_1=$(uname -m) \ && local ARCH_2=$(uname -m | sed -e 's/x86_64/x64/') \ && local ATOM_JULIA=$(curl -sL https://github.com/JuliaLang/julia/releases.atom | grep -P 'releases/tag(?!.*(rc|alpha|beta))' | sort -r) \ - && if [ -n "${VER_JULIA_MAJOR}" ]; then - local VER_JULIA=$(echo "${ATOM_JULIA}" | grep -Po '\d[\d.]+' | grep -E "^${VER_JULIA_MAJOR}\\." | head -1) - else - local VER_JULIA=$(echo "${ATOM_JULIA}" | head -1 | grep -Po '\d[\d.]+') - fi \ - && local VER_JULIA_MAJOR=$(echo "${VER_JULIA}" | cut -d '.' -f1,2 ) \ + && case "${VER_JULIA}" in + '') VER_JULIA=$(echo "${ATOM_JULIA}" | head -1 | grep -Po '\d[\d.]+') ;; + *.*.*) ;; + *) VER_JULIA=$(echo "${ATOM_JULIA}" | grep -Po '\d[\d.]+' | grep -E "^${VER_JULIA}\\." | head -1) ;; + esac \ + && local VER_JULIA_MAJOR=$(echo "${VER_JULIA}" | cut -d '.' -f1,2) \ && local URL_JULIA="https://julialang-s3.julialang.org/bin/linux/${ARCH_2}/${VER_JULIA_MAJOR}/julia-${VER_JULIA}-linux-${ARCH_1}.tar.gz" \ && echo "Downloading Julia version ${VER_JULIA} from: ${URL_JULIA}" \ && install_tar_gz $URL_JULIA \ @@ -336,7 +336,7 @@ setup_bazel() { setup_gradle() { - local VER_GRADLE=$(curl -sL https://github.com/gradle/gradle/releases.atom | grep 'releases/tag' | grep -v 'M' | head -1 | grep -Po '\d[\d.]+' ) \ + local VER_GRADLE="${1:-$(curl -sL https://github.com/gradle/gradle/releases.atom | grep 'releases/tag' | grep -v 'M' | head -1 | grep -Po '\d[\d.]+' )}" \ && local URL_GRADLE="https://downloads.gradle.org/distributions/gradle-${VER_GRADLE}-bin.zip" \ && mv /opt/gradle* /opt/gradle \ && ln -sf /opt/gradle/bin/gradle /usr/bin ; diff --git a/docker_core/core.Dockerfile b/docker_core/core.Dockerfile index f4b8fe5..b00e25f 100644 --- a/docker_core/core.Dockerfile +++ b/docker_core/core.Dockerfile @@ -30,22 +30,22 @@ COPY work /opt/utils/ RUN set -eux \ && source /opt/utils/script-setup-core.sh \ - # ----------------------------- + ## ----------------------------- && echo "NodeJS is required to build some components like JupyterLab Extensions later" \ && for profile in $(echo $ARG_PROFILE_NODEJS | tr "," "\n") ; do ( setup_node_${profile} ) ; done \ - # ----------------------------- + ## ----------------------------- && echo "If installing Java environment - notice that Java can be dependency for some other packages like rJava" \ && export VERSION_JDK=${VERSION_JDK:-11} \ && for profile in $(echo $ARG_PROFILE_JAVA | tr "," "\n") ; do ( setup_java_${profile} ) ; done \ - # ----------------------------- + ## ----------------------------- && echo "If installing LaTex and LaTex CJK packages." \ && for profile in $(echo $ARG_PROFILE_LATEX | tr "," "\n") ; do ( install_apt "/opt/utils/install_list_latex_${profile}.apt" ) ; done \ - # ----------------------------- + ## ----------------------------- && echo "If installing R environment - put this after Java ready to configure rJava" \ && source /opt/utils/script-setup-R.sh \ && for profile in $(echo $ARG_PROFILE_R | tr "," "\n") ; do ( setup_R_${profile} ) ; done \ && ( which R && ln -sf "${CONDA_PREFIX}"/bin/python3.* /usr/bin/ || true ) && ls -alh /usr/bin/python* \ - # ----------------------------- + ## ----------------------------- && echo "If on a x86_64 architecture: 1) if mkl specified, install nomkl; 2) install conda packages as specified." \ && if echo $(arch) | grep -q "x86_64" ; then \ echo "mkl" >> /opt/utils/install_list_core.conda && echo "Install mkl." ; \ @@ -54,38 +54,39 @@ RUN set -eux \ fi \ && ln -sf /opt/utils/install_list_core.conda /opt/utils/install_list_PY_mkl.pip \ && install_mamba /opt/utils/install_list_core.conda \ - # ----------------------------- + ## ----------------------------- && echo "If installing Python packages" \ && ( $(grep -q "datascience" <<< "${ARG_PROFILE_PYTHON}") && ( \ ( which R && echo "rpy2 % Install rpy2 if R exists" >> /opt/utils/install_list_PY_datascience.pip || echo "Skip rpy2 install" ) \ && ( which java && echo "py4j % Install py4j if Java exists" >> /opt/utils/install_list_PY_datascience.pip || echo "Skip py4j install" ) \ ) || echo "Skip Python datascience packages install" ) \ - # ----------------------------- - && export CUDA_VER=$(echo ${CUDA_VERSION:-"999"} | cut -c1-4 | sed 's/\.//' ) \ + ## ----------------------------- + && export DEFAULT_CUDA_VERSION_FALLBACK="999" \ + && export CUDA_VER=$(echo ${CUDA_VERSION:-"${DEFAULT_CUDA_VERSION_FALLBACK}"} | cut -c1-4 | sed 's/\.//' ) \ && export IDX=$( [ -x "$(command -v nvcc)" ] && echo "cu${CUDA_VER:-117}" || echo "cpu" ) \ && echo "Detected CUDA version=${CUDA_VER} and IDX=${IDX}" \ - # ----------------------------- + ## ----------------------------- && echo "Handle tensorflow installation 1.x/2.x, cpu/gpu: https://www.tensorflow.org/install/source#gpu" \ && ( $(grep -q "tf" <<< "${ARG_PROFILE_PYTHON}") && ( \ V=$($(grep -q "tf1" <<< "${ARG_PROFILE_PYTHON}") && echo "1" || echo "2" ) \ TF=$( [ "$V" == "1" ] && echo "tensorflow-gpu" || echo "tensorflow") \ && echo "${TF}==${V}.*" > "/opt/utils/install_list_PY_tf${V}.pip" \ ) || echo "Skipping tf install" ) \ - # ----------------------------- + ## ----------------------------- && echo "Handle pytorch installation 1.x only, cpu/gpu: https://pytorch.org/get-started/locally/" \ && ( $(grep -q "torch" <<< "${ARG_PROFILE_PYTHON}") && ( \ echo "If CUDA version < 11.7, install pytorch 1.x, else install pytorch 2.x; if cuda doesn't exist, install pytorch 2.x" \ && export CUDA_VER_TORCH="117" && V=$([[ "${CUDA_VER:-999}" -lt "${CUDA_VER_TORCH}" ]] && echo "torch<2" || echo "torch") \ && pip install --no-cache-dir --root-user-action=ignore -U --pre "${V}" torchvision torchaudio --index-url "https://download.pytorch.org/whl/${IDX}" \ ) || echo "Skipping pytorch install" ) \ - # ----------------------------- + ## ----------------------------- && echo "Handle paddle installation, cpu/gpu: https://www.paddlepaddle.org.cn/" \ && ( $(grep -q "paddle" <<< "${ARG_PROFILE_PYTHON}") && ( \ URL_PYPI_PADDLE="https://www.paddlepaddle.org.cn/packages/stable/${IDX}/" \ && PADDLE=$( [ -x "$(command -v nvcc)" ] && echo "paddlepaddle-gpu" || echo "paddlepaddle") \ && pip install --no-cache-dir --root-user-action=ignore -U --pre --index-url ${URL_PYPI_PADDLE} "${PADDLE}" \ ) || echo "Skip paddle install" ) \ - # ----------------------------- + ## ----------------------------- # && [ "${PIP_FIND_LINKS+set}" != "set" ] && echo "PIP_FIND_LINKS is not set!" || echo "PIP_FIND_LINKS is set to: ${PIP_FIND_LINKS}" \ && for profile in $(echo $ARG_PROFILE_PYTHON | tr "," "\n") ; do ( \ [ -f "/opt/utils/install_list_PY_${profile}.apt" ] && install_apt "/opt/utils/install_list_PY_${profile}.apt" || echo "apt install skipped for ${profile}" ; \ @@ -96,30 +97,30 @@ RUN set -eux \ && pip freeze | awk -F= 'tolower($1) ~ /^nvidia-/ {print $1}' | xargs -r pip uninstall -y \ && apt-get -qq update --fix-missing && apt-get -qq install -y --no-install-recommends --allow-change-held-packages libcusparselt0 libnccl2 libnccl-dev ; \ fi \ - # ----------------------------- + ## ----------------------------- && if echo "${ARG_PROFILE_GO}" | grep -q "base" ; then \ echo "Installing GO: ${ARG_PROFILE_GO}" && setup_GO ; \ else \ echo "Skip installing GO" ; \ fi \ - # ----------------------------- + ## ----------------------------- && if echo "${ARG_PROFILE_RUST}" | grep -q "base" ; then \ echo "Installing rust: ${ARG_PROFILE_RUST}" && setup_rust ; \ else \ echo "Skip installing rust" ; \ fi \ - # ----------------------------- + ## ----------------------------- && if echo "${ARG_PROFILE_JULIA}" | grep -q "base" ; then \ echo "Installing julia: ${ARG_PROFILE_JULIA}" && setup_julia ; \ else \ echo "Skip installing julia" ; \ fi \ - # ----------------------------- + ## ----------------------------- && if echo "${ARG_PROFILE_OCTAVE}" | grep -q "base" ; then \ echo "Installing Octave: ${ARG_PROFILE_OCTAVE}" && setup_octave ; \ else \ echo "Skip installing octave" ; \ fi \ - # ----------------------------- + ## ----------------------------- && echo "Clean up and display components version information..." \ && list_installed_packages && install__clean diff --git a/docker_cuda/nvidia-cuda.Dockerfile b/docker_cuda/nvidia-cuda.Dockerfile index b2fff3f..06734f5 100644 --- a/docker_cuda/nvidia-cuda.Dockerfile +++ b/docker_cuda/nvidia-cuda.Dockerfile @@ -9,7 +9,7 @@ LABEL maintainer="postmaster@labnow.ai" # Let NVIDIA docker ignore cuda requirement check ENV NVIDIA_DISABLE_REQUIRE=1 -# For cuda version 10.0, the image is solely serverd for legacy tensorflow 1.15, which requires python 3.7 +# For cuda version 10.0, the image is solely served for legacy tensorflow 1.15, which requires python 3.7 # For tensorflow 2.x or torch, python>=3.9 is supported. RUN set -eux && echo ${CUDA_VERSION} && nvcc --version \ # HACK & FIX: for some old version of NVIDIA docker images, sys python version is too old, update debpython diff --git a/tool.sh b/tool.sh index 7e714c8..7adcc11 100755 --- a/tool.sh +++ b/tool.sh @@ -57,7 +57,7 @@ push_image() { } clear_images() { - KEYWORD=${1:-'days ago\|weeks ago\|months ago\|years ago'}; # if no keyword is provided, clear all images build days ago + KEYWORD=${1:-'days ago\|weeks ago\|months ago\|years ago'}; # if no keyword is provided, clear all images built days ago IMGS_1=$(docker images | grep "${KEYWORD}" | awk '{print $1 ":" $2}') ; IMGS_2=$(docker images | grep "${KEYWORD}" | awk '{print $3}') ; From ff1d9a21cc9c638764c55a2116091b72cca119bf Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 18:50:46 +0800 Subject: [PATCH 2/7] Refactor setup functions to improve version handling for Maven, Lua, and LuaRocks --- docker_atom/work/script-setup-core.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index 9b2d8c2..d17abcb 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -136,14 +136,13 @@ setup_java_base() { setup_java_maven() { - local VER_MAVEN_MAJOR="${1-3}" \ + local VER_MAVEN="${1:-3}" \ && local ATOM_MAVEN=$(curl -sL https://maven.apache.org/docs/history.html | grep '/ref/') \ && local VERS_MAVEN=$(echo "${ATOM_MAVEN}" | grep -oP '(?<=/ref/)[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-z]+-[0-9]+)?(?=/)' | sort -r) \ - && if [ -n "${VER_MAVEN_MAJOR}" ]; then - local VER_MAVEN=$(echo "${VERS_MAVEN}" | grep -E "^${VER_MAVEN_MAJOR}\\." | sort -rV | head -1) - else - local VER_MAVEN=$(echo "${VERS_MAVEN}" | sort -rV | head -1) - fi \ + && case "${VER_MAVEN}" in + *.*.*) ;; + *) VER_MAVEN=$(echo "${VERS_MAVEN}" | grep -E "^${VER_MAVEN}\\." | sort -rV | head -1) ;; + esac \ && local URL_MAVEN="https://archive.apache.org/dist/maven/maven-3/${VER_MAVEN}/binaries/apache-maven-${VER_MAVEN}-bin.zip" \ && echo "Downloading Maven version ${VER_MAVEN} from: ${URL_MAVEN}" \ && install_zip "${URL_MAVEN}" \ @@ -295,7 +294,7 @@ setup_julia() { setup_lua_base() { - local VER_LUA=$(curl -sL https://www.lua.org/download.html | grep "cd lua" | head -1 | grep -Po '(\d[\d|.]+)') \ + local VER_LUA="${1:-$(curl -sL https://www.lua.org/download.html | grep "cd lua" | head -1 | grep -Po '(\d[\d|.]+)')}" \ && local URL_LUA="https://www.lua.org/ftp/lua-${VER_LUA}.tar.gz" \ && echo "Downloading LUA ${VER_LUA} from ${URL_LUA}" \ && install_tar_gz $URL_LUA \ @@ -310,7 +309,7 @@ setup_lua_base() { setup_lua_rocks() { ## https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ - && local VER_LUA_ROCKS=$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | head -1 | grep -Po '(\d[\d|.]+)' | head -1) \ + && local VER_LUA_ROCKS="${1:-$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | head -1 | grep -Po '(\d[\d|.]+)' | head -1)}" \ && local URL_LUA_ROCKS="https://luarocks.org/releases/luarocks-${VER_LUA_ROCKS}.tar.gz" \ && echo "Downloading luarocks ${VER_LUA_ROCKS} from ${URL_LUA_ROCKS}" \ && install_tar_gz $URL_LUA_ROCKS \ From 5a637d877c4e240248381cd31d1241ffc048bd0e Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 19:29:30 +0800 Subject: [PATCH 3/7] update scripts --- docker_atom/work/script-setup-core.sh | 145 +++++++++++++++----- docker_atom/work/script-setup-db-clients.sh | 11 +- docker_atom/work/script-setup-net.sh | 33 ++++- docker_atom/work/script-setup-sys.sh | 22 ++- tool.sh | 1 + 5 files changed, 173 insertions(+), 39 deletions(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index d17abcb..4ed2cd3 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -138,11 +138,11 @@ setup_java_base() { setup_java_maven() { local VER_MAVEN="${1:-3}" \ && local ATOM_MAVEN=$(curl -sL https://maven.apache.org/docs/history.html | grep '/ref/') \ - && local VERS_MAVEN=$(echo "${ATOM_MAVEN}" | grep -oP '(?<=/ref/)[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-z]+-[0-9]+)?(?=/)' | sort -r) \ - && case "${VER_MAVEN}" in - *.*.*) ;; - *) VER_MAVEN=$(echo "${VERS_MAVEN}" | grep -E "^${VER_MAVEN}\\." | sort -rV | head -1) ;; - esac \ + && local VERS_MAVEN=$(echo "${ATOM_MAVEN}" | grep -oP '(?<=/ref/)[0-9]+\.[0-9]+(\.[0-9]+)?(-[a-z]+-[0-9]+)?(?=/)' | sort -rV) \ + && local VER_MAVEN_RE=${VER_MAVEN#v} \ + && VER_MAVEN_RE=${VER_MAVEN_RE//./\\.} \ + && VER_MAVEN=$(echo "${VERS_MAVEN}" | grep -m1 -E "^${VER_MAVEN_RE}([.-]|$)") \ + && [ -n "${VER_MAVEN}" ] \ && local URL_MAVEN="https://archive.apache.org/dist/maven/maven-3/${VER_MAVEN}/binaries/apache-maven-${VER_MAVEN}-bin.zip" \ && echo "Downloading Maven version ${VER_MAVEN} from: ${URL_MAVEN}" \ && install_zip "${URL_MAVEN}" \ @@ -154,17 +154,25 @@ setup_java_maven() { setup_node_base() { - local VER_NODEJS="${1:-}" \ + local VER_NODEJS_REQ="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/aarch64/arm64/') \ && local ATOM_NODEJS=$(curl -sL https://github.com/nodejs/node/releases.atom | grep 'releases/tag' | sort -r) \ - && case "${VER_NODEJS}" in - '') VER_NODEJS=$(echo "${ATOM_NODEJS}" | head -1 | grep -Po '\d[\.\d]+') ;; - *.*.*) ;; - *) VER_NODEJS=$(echo "${ATOM_NODEJS}" | grep -Po '\d[\.\d]+' | grep -E "^${VER_NODEJS}\\." | head -1) ;; - esac \ - && local VER_NODEJS_MAJOR=$(echo "${VER_NODEJS}" | cut -d '.' -f1) \ - && local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS_MAJOR}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" \ + && local VERS_NODEJS=$(echo "${ATOM_NODEJS}" | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_NODEJS_REQ}" ]; then + local VER_NODEJS_RE=${VER_NODEJS_REQ#v} \ + && VER_NODEJS_RE=${VER_NODEJS_RE//./\\.} \ + && local VER_NODEJS=$(echo "${VERS_NODEJS}" | grep -m1 -E "^${VER_NODEJS_RE}([.-]|$)") \ + && [ -n "${VER_NODEJS}" ] \ + && case "${VER_NODEJS_REQ}" in + *.*) local URL_NODEJS="https://nodejs.org/download/release/v${VER_NODEJS}/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ;; + *) local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ;; + esac ; + else + local VER_NODEJS=$(echo "${VERS_NODEJS}" | head -1) \ + && local VER_NODEJS_MAJOR=$(echo "${VER_NODEJS}" | cut -d '.' -f1) \ + && local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS_MAJOR}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ; + fi \ && echo "Downloading NodeJS version ${VER_NODEJS} from: ${URL_NODEJS}" \ && install_tar_gz ${URL_NODEJS} \ && mv /opt/node* /opt/node \ @@ -178,10 +186,18 @@ setup_node_base() { } setup_node_pnpm() { - local VER_PNPM UNAME ARCH URL_PNPM TMPDIR ; + local VER_PNPM_REQ="${1:-}" UNAME ARCH URL_PNPM TMPDIR ; UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/aarch64/arm64/' -e 's/armv7l/arm/') \ - && VER_PNPM="${1:-$(curl -fsSL https://github.com/pnpm/pnpm/releases.atom | grep -Po '(?<=tag/v)\d[\d.]+' | grep -v alpha | sort -V | tail -1)}" \ + && local VERS_PNPM=$(curl -fsSL https://github.com/pnpm/pnpm/releases.atom | grep -Po '(?<=tag/v)\d[\d.]+' | grep -v alpha | sort -rV) \ + && if [ -n "${VER_PNPM_REQ}" ]; then + local VER_PNPM_RE=${VER_PNPM_REQ#v} \ + && VER_PNPM_RE=${VER_PNPM_RE//./\\.} \ + && local VER_PNPM=$(echo "${VERS_PNPM}" | grep -m1 -E "^${VER_PNPM_RE}([.-]|$)") + else + local VER_PNPM=$(echo "${VERS_PNPM}" | head -1) + fi \ + && [ -n "${VER_PNPM}" ] \ && mkdir -p /opt/node/bin /opt/node/pnpm-store \ && if [ "${VER_PNPM%%.*}" -ge 11 ]; then URL_PNPM="https://github.com/pnpm/pnpm/releases/download/v${VER_PNPM}/pnpm-${UNAME}-${ARCH}.tar.gz" \ @@ -200,9 +216,19 @@ setup_node_pnpm() { } setup_node_bun() { - local VER_BUN="${1:-$(curl -sL https://github.com/oven-sh/bun/releases.atom | grep 'releases/tag' | sort -r | head -1 | grep -Po 'bun-v\K\d+\.\d+\.\d+')}" \ + local VER_BUN_REQ="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(uname -m | sed -e 's/x86_64/x64/' ) \ + && local ATOM_BUN=$(curl -sL https://github.com/oven-sh/bun/releases.atom | grep 'releases/tag' | sort -r) \ + && local VERS_BUN=$(echo "${ATOM_BUN}" | grep -Po 'bun-v\K\d+\.\d+\.\d+' | sort -rV) \ + && if [ -n "${VER_BUN_REQ}" ]; then + local VER_BUN_RE=${VER_BUN_REQ#v} \ + && VER_BUN_RE=${VER_BUN_RE//./\\.} \ + && local VER_BUN=$(echo "${VERS_BUN}" | grep -m1 -E "^${VER_BUN_RE}([.-]|$)") + else + local VER_BUN=$(echo "${VERS_BUN}" | head -1) + fi \ + && [ -n "${VER_BUN}" ] \ && local URL_BUN="https://github.com/oven-sh/bun/releases/download/bun-v${VER_BUN}/bun-${UNAME}-${ARCH}.zip" \ && echo "Downloading bun version ${VER_BUN} from: ${URL_BUN}" \ && install_zip "${URL_BUN}" \ @@ -216,15 +242,19 @@ setup_node_bun() { setup_GO() { - local VER_GO="${1:-}" \ + local VER_GO_REQ="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(dpkg --print-architecture) \ && local ATOM_GO=$(curl -sL https://github.com/golang/go/releases.atom | grep 'releases/tag' | grep -v 'rc' | sort -r) \ - && case "${VER_GO}" in - '') VER_GO=$(echo "${ATOM_GO}" | head -1 | grep -Po '\d[\d.]+') ;; - *.*.*) ;; - *) VER_GO=$(echo "${ATOM_GO}" | grep -Po '\d[\d.]+' | grep -E "^${VER_GO}\\." | head -1) ;; - esac \ + && local VERS_GO=$(echo "${ATOM_GO}" | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_GO_REQ}" ]; then + local VER_GO_RE=${VER_GO_REQ#v} \ + && VER_GO_RE=${VER_GO_RE//./\\.} \ + && local VER_GO=$(echo "${VERS_GO}" | grep -m1 -E "^${VER_GO_RE}([.-]|$)") + else + local VER_GO=$(echo "${VERS_GO}" | head -1) + fi \ + && [ -n "${VER_GO}" ] \ && local URL_GO="https://dl.google.com/go/go${VER_GO}.${UNAME}-${ARCH}.tar.gz" \ && echo "Downloading golang version ${VER_GO} from: ${URL_GO}" \ && install_tar_gz "${URL_GO}" go \ @@ -269,16 +299,20 @@ setup_R_base() { setup_julia() { - local VER_JULIA="${1:-}" \ + local VER_JULIA_REQ="${1:-}" \ && local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH_1=$(uname -m) \ && local ARCH_2=$(uname -m | sed -e 's/x86_64/x64/') \ && local ATOM_JULIA=$(curl -sL https://github.com/JuliaLang/julia/releases.atom | grep -P 'releases/tag(?!.*(rc|alpha|beta))' | sort -r) \ - && case "${VER_JULIA}" in - '') VER_JULIA=$(echo "${ATOM_JULIA}" | head -1 | grep -Po '\d[\d.]+') ;; - *.*.*) ;; - *) VER_JULIA=$(echo "${ATOM_JULIA}" | grep -Po '\d[\d.]+' | grep -E "^${VER_JULIA}\\." | head -1) ;; - esac \ + && local VERS_JULIA=$(echo "${ATOM_JULIA}" | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_JULIA_REQ}" ]; then + local VER_JULIA_RE=${VER_JULIA_REQ#v} \ + && VER_JULIA_RE=${VER_JULIA_RE//./\\.} \ + && local VER_JULIA=$(echo "${VERS_JULIA}" | grep -m1 -E "^${VER_JULIA_RE}([.-]|$)") + else + local VER_JULIA=$(echo "${VERS_JULIA}" | head -1) + fi \ + && [ -n "${VER_JULIA}" ] \ && local VER_JULIA_MAJOR=$(echo "${VER_JULIA}" | cut -d '.' -f1,2) \ && local URL_JULIA="https://julialang-s3.julialang.org/bin/linux/${ARCH_2}/${VER_JULIA_MAJOR}/julia-${VER_JULIA}-linux-${ARCH_1}.tar.gz" \ && echo "Downloading Julia version ${VER_JULIA} from: ${URL_JULIA}" \ @@ -294,7 +328,16 @@ setup_julia() { setup_lua_base() { - local VER_LUA="${1:-$(curl -sL https://www.lua.org/download.html | grep "cd lua" | head -1 | grep -Po '(\d[\d|.]+)')}" \ + local VER_LUA_REQ="${1:-}" \ + && local VERS_LUA=$(curl -sL https://www.lua.org/download.html | grep "cd lua" | grep -Po '(\d[\d|.]+)' | sort -rV) \ + && if [ -n "${VER_LUA_REQ}" ]; then + local VER_LUA_RE=${VER_LUA_REQ#v} \ + && VER_LUA_RE=${VER_LUA_RE//./\\.} \ + && local VER_LUA=$(echo "${VERS_LUA}" | grep -m1 -E "^${VER_LUA_RE}([.-]|$)") + else + local VER_LUA=$(echo "${VERS_LUA}" | head -1) + fi \ + && [ -n "${VER_LUA}" ] \ && local URL_LUA="https://www.lua.org/ftp/lua-${VER_LUA}.tar.gz" \ && echo "Downloading LUA ${VER_LUA} from ${URL_LUA}" \ && install_tar_gz $URL_LUA \ @@ -309,7 +352,16 @@ setup_lua_base() { setup_lua_rocks() { ## https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ - && local VER_LUA_ROCKS="${1:-$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | head -1 | grep -Po '(\d[\d|.]+)' | head -1)}" \ + && local VER_LUA_ROCKS_REQ="${1:-}" \ + && local VERS_LUA_ROCKS=$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | grep -Po '(\d[\d|.]+)' | sort -rV) \ + && if [ -n "${VER_LUA_ROCKS_REQ}" ]; then + local VER_LUA_ROCKS_RE=${VER_LUA_ROCKS_REQ#v} \ + && VER_LUA_ROCKS_RE=${VER_LUA_ROCKS_RE//./\\.} \ + && local VER_LUA_ROCKS=$(echo "${VERS_LUA_ROCKS}" | grep -m1 -E "^${VER_LUA_ROCKS_RE}([.-]|$)") + else + local VER_LUA_ROCKS=$(echo "${VERS_LUA_ROCKS}" | head -1) + fi \ + && [ -n "${VER_LUA_ROCKS}" ] \ && local URL_LUA_ROCKS="https://luarocks.org/releases/luarocks-${VER_LUA_ROCKS}.tar.gz" \ && echo "Downloading luarocks ${VER_LUA_ROCKS} from ${URL_LUA_ROCKS}" \ && install_tar_gz $URL_LUA_ROCKS \ @@ -325,7 +377,16 @@ setup_lua_rocks() { setup_bazel() { local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local ARCH=$(uname -m | sed -e 's/aarch64/arm64/') \ - && local VER_BAZEL="${1:-$(curl -sL https://github.com/bazelbuild/bazel/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' )}" \ + && local VER_BAZEL_REQ="${1:-}" \ + && local VERS_BAZEL=$(curl -sL https://github.com/bazelbuild/bazel/releases.atom | grep 'releases/tag' | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_BAZEL_REQ}" ]; then + local VER_BAZEL_RE=${VER_BAZEL_REQ#v} \ + && VER_BAZEL_RE=${VER_BAZEL_RE//./\\.} \ + && local VER_BAZEL=$(echo "${VERS_BAZEL}" | grep -m1 -E "^${VER_BAZEL_RE}([.-]|$)") + else + local VER_BAZEL=$(echo "${VERS_BAZEL}" | head -1) + fi \ + && [ -n "${VER_BAZEL}" ] \ && local URL_BAZEL="https://github.com/bazelbuild/bazel/releases/download/${VER_BAZEL}/bazel-${VER_BAZEL}-installer-${UNAME}-${ARCH}.sh" \ && curl -o /tmp/bazel.sh -sL "${URL_BAZEL}" && chmod +x /tmp/bazel.sh \ && /tmp/bazel.sh && rm /tmp/bazel.sh ; @@ -335,7 +396,16 @@ setup_bazel() { setup_gradle() { - local VER_GRADLE="${1:-$(curl -sL https://github.com/gradle/gradle/releases.atom | grep 'releases/tag' | grep -v 'M' | head -1 | grep -Po '\d[\d.]+' )}" \ + local VER_GRADLE_REQ="${1:-}" \ + && local VERS_GRADLE=$(curl -sL https://github.com/gradle/gradle/releases.atom | grep 'releases/tag' | grep -v 'M' | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_GRADLE_REQ}" ]; then + local VER_GRADLE_RE=${VER_GRADLE_REQ#v} \ + && VER_GRADLE_RE=${VER_GRADLE_RE//./\\.} \ + && local VER_GRADLE=$(echo "${VERS_GRADLE}" | grep -m1 -E "^${VER_GRADLE_RE}([.-]|$)") + else + local VER_GRADLE=$(echo "${VERS_GRADLE}" | head -1) + fi \ + && [ -n "${VER_GRADLE}" ] \ && local URL_GRADLE="https://downloads.gradle.org/distributions/gradle-${VER_GRADLE}-bin.zip" \ && mv /opt/gradle* /opt/gradle \ && ln -sf /opt/gradle/bin/gradle /usr/bin ; @@ -347,7 +417,16 @@ setup_gradle() { setup_yq() { local ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/' -e 's/armv7l/arm/') ; [[ "$ARCH" =~ ^(amd64|arm64|arm)$ ]] || { echo "Unsupported architecture for yq: $(uname -m)"; return 1; } - local VER_YQ="${1:-$(curl -sL -o /dev/null -w "%{url_effective}" https://github.com/mikefarah/yq/releases/latest | grep -oP 'v\K[\d.]+')}" \ + local VER_YQ_REQ="${1:-}" \ + && local VERS_YQ=$(curl -sL https://github.com/mikefarah/yq/releases.atom | grep 'releases/tag' | grep -Po 'v\K[\d.]+' | sort -rV) \ + && if [ -n "${VER_YQ_REQ}" ]; then + local VER_YQ_RE=${VER_YQ_REQ#v} \ + && VER_YQ_RE=${VER_YQ_RE//./\\.} \ + && local VER_YQ=$(echo "${VERS_YQ}" | grep -m1 -E "^${VER_YQ_RE}([.-]|$)") \ + else + local VER_YQ=$(echo "${VERS_YQ}" | head -1) + fi \ + && [ -n "${VER_YQ}" ] \ && local URL_YQ="https://github.com/mikefarah/yq/releases/download/v${VER_YQ}/yq_linux_${ARCH}" \ && echo "Installing yq v${VER_YQ} for arch ${ARCH} from: ${URL_YQ}" \ && curl -fSL "${URL_YQ}" -o /tmp/yq \ diff --git a/docker_atom/work/script-setup-db-clients.sh b/docker_atom/work/script-setup-db-clients.sh index 7c79525..3f97ad0 100644 --- a/docker_atom/work/script-setup-db-clients.sh +++ b/docker_atom/work/script-setup-db-clients.sh @@ -15,7 +15,16 @@ setup_postgresql_client() { setup_duckdb() { local ARCH="$(uname -m)" \ && local ARCH_DUCKDB=$([ "$ARCH" = "x86_64" ] && echo "amd64" || echo "arm64") \ - && local VER_DUCKDB="${1:-$(curl -s https://api.github.com/repos/duckdb/duckdb/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//')}" \ + && local VER_DUCKDB_REQ="${1:-}" \ + && local VERS_DUCKDB=$(curl -s https://api.github.com/repos/duckdb/duckdb/releases | grep -oP '"tag_name":\s*"\K[^"]+' | sed 's/^v//' | sort -rV) \ + && if [ -n "${VER_DUCKDB_REQ}" ]; then + local VER_DUCKDB_RE=${VER_DUCKDB_REQ#v} \ + && VER_DUCKDB_RE=${VER_DUCKDB_RE//./\\.} \ + && local VER_DUCKDB=$(echo "${VERS_DUCKDB}" | grep -m1 -E "^${VER_DUCKDB_RE}([.-]|$)") + else + local VER_DUCKDB=$(echo "${VERS_DUCKDB}" | head -1) + fi \ + && [ -n "${VER_DUCKDB}" ] \ && local URL_DUCKDB="https://github.com/duckdb/duckdb/releases/download/v${VER_DUCKDB}/duckdb_cli-linux-${ARCH_DUCKDB}.zip" \ && local TMP_FILE="/tmp/duckdb-${VER_DUCKDB}.zip" \ && echo "Downloading DuckDB ${VER_DUCKDB} from: ${URL_DUCKDB}" \ diff --git a/docker_atom/work/script-setup-net.sh b/docker_atom/work/script-setup-net.sh index 29aa75e..13938d8 100644 --- a/docker_atom/work/script-setup-net.sh +++ b/docker_atom/work/script-setup-net.sh @@ -1,5 +1,14 @@ setup_traefik() { - VER_TRAEFIK="${1:-$(curl -sL https://github.com/traefik/traefik/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+')}" \ + local VER_TRAEFIK_REQ="${1:-}" \ + && local VERS_TRAEFIK=$(curl -sL https://github.com/traefik/traefik/releases.atom | grep 'releases/tag' | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_TRAEFIK_REQ}" ]; then + local VER_TRAEFIK_RE=${VER_TRAEFIK_REQ#v} \ + && VER_TRAEFIK_RE=${VER_TRAEFIK_RE//./\\.} \ + && local VER_TRAEFIK=$(echo "${VERS_TRAEFIK}" | grep -m1 -E "^${VER_TRAEFIK_RE}([.-]|$)") + else + local VER_TRAEFIK=$(echo "${VERS_TRAEFIK}" | head -1) + fi \ + && [ -n "${VER_TRAEFIK}" ] \ && URL_TRAEFIK="https://github.com/traefik/traefik/releases/download/v${VER_TRAEFIK}/traefik_v${VER_TRAEFIK}_linux_$(dpkg --print-architecture).tar.gz" \ && curl -o /tmp/TMP.tgz -sL "${URL_TRAEFIK}" \ && mkdir -pv /opt/bin && tar -C /opt/bin -xzf /tmp/TMP.tgz traefik && rm /tmp/TMP.tgz \ @@ -11,7 +20,16 @@ setup_traefik() { setup_caddy() { UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') \ - && VER_CADDY="${1:-$(curl -sL https://github.com/caddyserver/caddy/releases.atom | grep "releases/tag" | grep -v 'beta' | head -1 | grep -Po '(\d[\d|.]+)')}" \ + && local VER_CADDY_REQ="${1:-}" \ + && local VERS_CADDY=$(curl -sL https://github.com/caddyserver/caddy/releases.atom | grep "releases/tag" | grep -v 'beta' | grep -Po '(\d[\d|.]+)' | sort -rV) \ + && if [ -n "${VER_CADDY_REQ}" ]; then + local VER_CADDY_RE=${VER_CADDY_REQ#v} \ + && VER_CADDY_RE=${VER_CADDY_RE//./\\.} \ + && local VER_CADDY=$(echo "${VERS_CADDY}" | grep -m1 -E "^${VER_CADDY_RE}([.-]|$)") + else + local VER_CADDY=$(echo "${VERS_CADDY}" | head -1) + fi \ + && [ -n "${VER_CADDY}" ] \ && URL_CADDY="https://github.com/caddyserver/caddy/releases/download/v${VER_CADDY}/caddy_${VER_CADDY}_${UNAME}_${ARCH}.tar.gz" \ && echo "Downloading Caddy ${VER_CADDY} from ${URL_CADDY}" \ && curl -o /tmp/TMP.tgz -sL "${URL_CADDY}" && tar -C /tmp/ -xzf /tmp/TMP.tgz && rm /tmp/TMP.tgz \ @@ -24,7 +42,16 @@ setup_oauth2_proxy() { local ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/' -e 's/armv7l/armv7/') ; [[ "$ARCH" =~ ^(amd64|arm64|armv7)$ ]] || { echo "Unsupported architecture for oauth2-proxy: $(uname -m)"; return 1; } - local VER_OAUTH2_PROXY="${1:-$(curl -sL -o /dev/null -w "%{url_effective}" https://github.com/oauth2-proxy/oauth2-proxy/releases/latest | grep -oP 'v\K[\d.]+')}" \ + local VER_OAUTH2_PROXY_REQ="${1:-}" \ + && local VERS_OAUTH2_PROXY=$(curl -sL https://github.com/oauth2-proxy/oauth2-proxy/releases.atom | grep 'releases/tag' | grep -Po '(?<=tag/v)\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_OAUTH2_PROXY_REQ}" ]; then + local VER_OAUTH2_PROXY_RE=${VER_OAUTH2_PROXY_REQ#v} \ + && VER_OAUTH2_PROXY_RE=${VER_OAUTH2_PROXY_RE//./\\.} \ + && local VER_OAUTH2_PROXY=$(echo "${VERS_OAUTH2_PROXY}" | grep -m1 -E "^${VER_OAUTH2_PROXY_RE}([.-]|$)") + else + local VER_OAUTH2_PROXY=$(echo "${VERS_OAUTH2_PROXY}" | head -1) + fi \ + && [ -n "${VER_OAUTH2_PROXY}" ] \ && local FILE_OAUTH2_PROXY="oauth2-proxy-v${VER_OAUTH2_PROXY}.linux-${ARCH}.tar.gz" \ && local URL_OAUTH2_PROXY="https://github.com/oauth2-proxy/oauth2-proxy/releases/download/v${VER_OAUTH2_PROXY}/${FILE_OAUTH2_PROXY}" \ && echo "Installing oauth2-proxy v${VER_OAUTH2_PROXY} for arch ${ARCH} from: ${URL_OAUTH2_PROXY}" \ diff --git a/docker_atom/work/script-setup-sys.sh b/docker_atom/work/script-setup-sys.sh index df30db6..6c54cce 100644 --- a/docker_atom/work/script-setup-sys.sh +++ b/docker_atom/work/script-setup-sys.sh @@ -3,7 +3,16 @@ source /opt/utils/script-utils.sh setup_tini() { ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') \ - && VER_TINI="${1:-$(curl -sL https://github.com/krallin/tini/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' )}" \ + && local VER_TINI_REQ="${1:-}" \ + && local VERS_TINI=$(curl -sL https://github.com/krallin/tini/releases.atom | grep 'releases/tag' | grep -Po '\d[\d.]+' | sort -rV) \ + && if [ -n "${VER_TINI_REQ}" ]; then + local VER_TINI_RE=${VER_TINI_REQ#v} \ + && VER_TINI_RE=${VER_TINI_RE//./\\.} \ + && local VER_TINI=$(echo "${VERS_TINI}" | grep -m1 -E "^${VER_TINI_RE}([.-]|$)") + else + local VER_TINI=$(echo "${VERS_TINI}" | head -1) + fi \ + && [ -n "${VER_TINI}" ] \ && URL_TINI="https://github.com/krallin/tini/releases/download/v${VER_TINI}/tini-${ARCH}" \ && echo "Downloading Tini ${VER_TINI} from ${URL_TINI}" \ && curl -o /usr/bin/tini -sL $URL_TINI && chmod +x /usr/bin/tini ; @@ -18,7 +27,16 @@ setup_tini() { setup_supervisord() { UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/') \ - && VER_SUPERVISORD="${1:-$(curl -sL https://github.com/LabNow-ai/supervisord/releases.atom | grep "releases/tag" | head -1 | grep -Po '(\d[\d|.]+)')}" \ + && local VER_SUPERVISORD_REQ="${1:-}" \ + && local VERS_SUPERVISORD=$(curl -sL https://github.com/LabNow-ai/supervisord/releases.atom | grep "releases/tag" | grep -Po '(\d[\d|.]+)' | sort -rV) \ + && if [ -n "${VER_SUPERVISORD_REQ}" ]; then + local VER_SUPERVISORD_RE=${VER_SUPERVISORD_REQ#v} \ + && VER_SUPERVISORD_RE=${VER_SUPERVISORD_RE//./\\.} \ + && local VER_SUPERVISORD=$(echo "${VERS_SUPERVISORD}" | grep -m1 -E "^${VER_SUPERVISORD_RE}([.-]|$)") + else + local VER_SUPERVISORD=$(echo "${VERS_SUPERVISORD}" | head -1) + fi \ + && [ -n "${VER_SUPERVISORD}" ] \ && URL_SUPERVISORD="https://github.com/LabNow-ai/supervisord/releases/download/v${VER_SUPERVISORD}/supervisord_${VER_SUPERVISORD}_${UNAME}_${ARCH}.tar.gz" \ && echo "Downloading Supervisord ${VER_SUPERVISORD} from ${URL_SUPERVISORD}" \ && curl -o /tmp/TMP.tgz -sL $URL_SUPERVISORD && tar -C /tmp/ -xzf /tmp/TMP.tgz && rm /tmp/TMP.tgz \ diff --git a/tool.sh b/tool.sh index 7adcc11..34f1f8e 100755 --- a/tool.sh +++ b/tool.sh @@ -47,6 +47,7 @@ push_image() { KEYWORD="${1:-second}"; docker image prune --force && docker images | sort; IMAGES=$(docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}" | grep "${KEYWORD}" | awk '{print $1 ":" $2}') ; + [ -n "${IMAGES}" ] || { echo "!! No images matched keyword: ${KEYWORD}" >&2; return 1; } echo "$DOCKER_REGISTRY_PASSWORD" | docker login "${REGISTRY_DST}" -u "$DOCKER_REGISTRY_USERNAME" --password-stdin ; for IMG in $(echo "${IMAGES}" | tr " " "\n") ; do From d71ca11dfb2dd1a442b08c4c08f67d6209d1fd18 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 19:43:59 +0800 Subject: [PATCH 4/7] fix yq install --- docker_atom/work/script-setup-core.sh | 6 +++--- tool.sh | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index 4ed2cd3..95372f6 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -417,14 +417,14 @@ setup_gradle() { setup_yq() { local ARCH=$(uname -m | sed -e 's/x86_64/amd64/' -e 's/aarch64/arm64/' -e 's/armv7l/arm/') ; [[ "$ARCH" =~ ^(amd64|arm64|arm)$ ]] || { echo "Unsupported architecture for yq: $(uname -m)"; return 1; } - local VER_YQ_REQ="${1:-}" \ + local VER_YQ="" VER_YQ_REQ="${1:-}" \ && local VERS_YQ=$(curl -sL https://github.com/mikefarah/yq/releases.atom | grep 'releases/tag' | grep -Po 'v\K[\d.]+' | sort -rV) \ && if [ -n "${VER_YQ_REQ}" ]; then local VER_YQ_RE=${VER_YQ_REQ#v} \ && VER_YQ_RE=${VER_YQ_RE//./\\.} \ - && local VER_YQ=$(echo "${VERS_YQ}" | grep -m1 -E "^${VER_YQ_RE}([.-]|$)") \ + && VER_YQ=$(echo "${VERS_YQ}" | grep -m1 -E "^${VER_YQ_RE}([.-]|$)") else - local VER_YQ=$(echo "${VERS_YQ}" | head -1) + VER_YQ=$(echo "${VERS_YQ}" | head -1) fi \ && [ -n "${VER_YQ}" ] \ && local URL_YQ="https://github.com/mikefarah/yq/releases/download/v${VER_YQ}/yq_linux_${ARCH}" \ diff --git a/tool.sh b/tool.sh index 34f1f8e..eb59a99 100755 --- a/tool.sh +++ b/tool.sh @@ -1,5 +1,5 @@ #!/bin/bash -set -xu +set -eux CI_PROJECT_NAME=${CI_PROJECT_NAME:-$GITHUB_REPOSITORY} CI_PROJECT_BRANCH=${GITHUB_HEAD_REF:-"main"} @@ -25,29 +25,29 @@ echo "--------> DOCKER_TAG_SUFFIX=${TAG_SUFFIX}" build_image() { echo "$@" ; IMG=$1; TAG=$2; FILE=$3; shift 3; VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX}; WORKDIR="$(dirname $FILE)"; - docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" >&2 - docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" >&2 + docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" + docker tag "${IMG_PREFIX_DST}/${IMG}:${TAG}" "${IMG_PREFIX_DST}/${IMG}:${VER}" echo "${IMG_PREFIX_DST}/${IMG}:${TAG}" } build_image_no_tag() { echo "$@" ; IMG=$1; TAG=$2; FILE=$3; shift 3; WORKDIR="$(dirname $FILE)"; - docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" >&2 + docker build --compress --force-rm=true -t "${IMG_PREFIX_DST}/${IMG}:${TAG}" -f "$FILE" --build-arg "BASE_NAMESPACE=${IMG_PREFIX_SRC}" "$@" "${WORKDIR}" echo "${IMG_PREFIX_DST}/${IMG}:${TAG}" } alias_image() { IMG_1=$1; TAG_1=$2; IMG_2=$3; TAG_2=$4; shift 4; VER=$(date +%Y.%m%d.%H%M)${TAG_SUFFIX}; - docker tag "${IMG_PREFIX_DST}/${IMG_1}:${TAG_1}" "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" >&2 - docker tag "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" "${IMG_PREFIX_DST}/${IMG_2}:${VER}" >&2 + docker tag "${IMG_PREFIX_DST}/${IMG_1}:${TAG_1}" "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" + docker tag "${IMG_PREFIX_DST}/${IMG_2}:${TAG_2}" "${IMG_PREFIX_DST}/${IMG_2}:${VER}" } push_image() { KEYWORD="${1:-second}"; docker image prune --force && docker images | sort; - IMAGES=$(docker images --format "table {{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}" | grep "${KEYWORD}" | awk '{print $1 ":" $2}') ; - [ -n "${IMAGES}" ] || { echo "!! No images matched keyword: ${KEYWORD}" >&2; return 1; } + IMAGES=$(docker images --format "{{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}" | grep "${KEYWORD}" | awk '{print $1 ":" $2}') ; + [ -n "${IMAGES}" ] || { echo "!! No images matched keyword: ${KEYWORD}"; return 1; } echo "$DOCKER_REGISTRY_PASSWORD" | docker login "${REGISTRY_DST}" -u "$DOCKER_REGISTRY_USERNAME" --password-stdin ; for IMG in $(echo "${IMAGES}" | tr " " "\n") ; do From 436a7e0cd01d617b897b166523df2ae7f9b5f6a3 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 20:34:29 +0800 Subject: [PATCH 5/7] Refactor Node.js and yq setup functions for improved version handling and download method --- docker_atom/work/script-setup-core.sh | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index 95372f6..df8db62 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -160,21 +160,15 @@ setup_node_base() { && local ATOM_NODEJS=$(curl -sL https://github.com/nodejs/node/releases.atom | grep 'releases/tag' | sort -r) \ && local VERS_NODEJS=$(echo "${ATOM_NODEJS}" | grep -Po '\d[\d.]+' | sort -rV) \ && if [ -n "${VER_NODEJS_REQ}" ]; then - local VER_NODEJS_RE=${VER_NODEJS_REQ#v} \ - && VER_NODEJS_RE=${VER_NODEJS_RE//./\\.} \ - && local VER_NODEJS=$(echo "${VERS_NODEJS}" | grep -m1 -E "^${VER_NODEJS_RE}([.-]|$)") \ - && [ -n "${VER_NODEJS}" ] \ - && case "${VER_NODEJS_REQ}" in - *.*) local URL_NODEJS="https://nodejs.org/download/release/v${VER_NODEJS}/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ;; - *) local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ;; - esac ; + local VER_NODEJS_RE=${VER_NODEJS_REQ#v} && VER_NODEJS_RE=${VER_NODEJS_RE//./\\.} \ + && local VER_NODEJS=$(echo "${VERS_NODEJS}" | grep -m1 -E "^${VER_NODEJS_RE}([.-]|$)") else - local VER_NODEJS=$(echo "${VERS_NODEJS}" | head -1) \ - && local VER_NODEJS_MAJOR=$(echo "${VER_NODEJS}" | cut -d '.' -f1) \ - && local URL_NODEJS="https://nodejs.org/download/release/latest-v${VER_NODEJS_MAJOR}.x/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" ; + local VER_NODEJS=$(echo "${VERS_NODEJS}" | head -1) fi \ + && [ -n "${VER_NODEJS}" ] \ + && local URL_NODEJS="https://nodejs.org/dist/v${VER_NODEJS}/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.xz" \ && echo "Downloading NodeJS version ${VER_NODEJS} from: ${URL_NODEJS}" \ - && install_tar_gz ${URL_NODEJS} \ + && install_tar_xz "${URL_NODEJS}" \ && mv /opt/node* /opt/node \ && ln -sf /opt/node/bin/n* /usr/bin/ \ && echo 'export PATH=${PATH}:/opt/node/bin' | sudo tee -a /etc/profile.d/path-node.sh \ @@ -187,7 +181,7 @@ setup_node_base() { setup_node_pnpm() { local VER_PNPM_REQ="${1:-}" UNAME ARCH URL_PNPM TMPDIR ; - UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ + UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && ARCH=$(uname -m | sed -e 's/x86_64/x64/' -e 's/aarch64/arm64/' -e 's/armv7l/arm/') \ && local VERS_PNPM=$(curl -fsSL https://github.com/pnpm/pnpm/releases.atom | grep -Po '(?<=tag/v)\d[\d.]+' | grep -v alpha | sort -rV) \ && if [ -n "${VER_PNPM_REQ}" ]; then @@ -420,8 +414,7 @@ setup_yq() { local VER_YQ="" VER_YQ_REQ="${1:-}" \ && local VERS_YQ=$(curl -sL https://github.com/mikefarah/yq/releases.atom | grep 'releases/tag' | grep -Po 'v\K[\d.]+' | sort -rV) \ && if [ -n "${VER_YQ_REQ}" ]; then - local VER_YQ_RE=${VER_YQ_REQ#v} \ - && VER_YQ_RE=${VER_YQ_RE//./\\.} \ + local VER_YQ_RE=${VER_YQ_REQ#v} && VER_YQ_RE=${VER_YQ_RE//./\\.} \ && VER_YQ=$(echo "${VERS_YQ}" | grep -m1 -E "^${VER_YQ_RE}([.-]|$)") else VER_YQ=$(echo "${VERS_YQ}" | head -1) @@ -432,7 +425,7 @@ setup_yq() { && curl -fSL "${URL_YQ}" -o /tmp/yq \ && install -m 0755 -D /tmp/yq /opt/bin/yq \ && ln -sf /opt/bin/yq /usr/bin/yq \ - && rm -f /tmp/yq + && rm -f /tmp/yq ; type yq && echo "@ Installed yq: $(yq --version)" } From f816b65b53133fa11f013ae330516e1d8114c01e Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 20:34:41 +0800 Subject: [PATCH 6/7] Fix regex pattern for LuaRocks version extraction in setup_lua_rocks function --- docker_atom/work/script-setup-core.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index df8db62..7afa776 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -347,7 +347,7 @@ setup_lua_rocks() { ## https://github.com/luarocks/luarocks/wiki/Installation-instructions-for-Unix local UNAME=$(uname | tr '[:upper:]' '[:lower:]') \ && local VER_LUA_ROCKS_REQ="${1:-}" \ - && local VERS_LUA_ROCKS=$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | grep -Po '(\d[\d|.]+)' | sort -rV) \ + && local VERS_LUA_ROCKS=$(curl -sL https://luarocks.github.io/luarocks/releases/ | grep "${UNAME}" | grep -Po '\d+\.\d+(\.\d+)?' | sort -rV) \ && if [ -n "${VER_LUA_ROCKS_REQ}" ]; then local VER_LUA_ROCKS_RE=${VER_LUA_ROCKS_REQ#v} \ && VER_LUA_ROCKS_RE=${VER_LUA_ROCKS_RE//./\\.} \ From a68ee98356a5bdb2f25cbc14aa529b4a94a363df Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 May 2026 21:02:30 +0800 Subject: [PATCH 7/7] use tar gz to download nodejs --- docker_atom/work/script-setup-core.sh | 20 +++----------------- docker_atom/work/script-setup-db-clients.sh | 2 -- docker_atom/work/script-setup-net.sh | 7 ++----- docker_atom/work/script-setup-sys.sh | 2 -- 4 files changed, 5 insertions(+), 26 deletions(-) diff --git a/docker_atom/work/script-setup-core.sh b/docker_atom/work/script-setup-core.sh index 7afa776..3e8f1e6 100644 --- a/docker_atom/work/script-setup-core.sh +++ b/docker_atom/work/script-setup-core.sh @@ -14,7 +14,6 @@ setup_mamba() { && printf "channels:\n" | sudo tee -a /etc/conda/.condarc \ && printf " - conda-forge\n" | sudo tee -a /etc/conda/.condarc \ && cat /etc/conda/.condarc ; - type mamba && echo "@ Version of mamba: $(mamba info)" || return -1 ; } @@ -92,7 +91,6 @@ setup_nvtop() { && make && sudo make install \ && cd "${DIRECTORY}" && rm -rf /tmp/nvtop \ && sudo apt-get -qq remove -y libncurses5-dev libdrm-dev libsystemd-dev libudev-dev ; - type nvtop && echo "Version of nvtop: $(nvtop --version)" || return -1 ; } @@ -129,7 +127,6 @@ setup_java_base() { echo "Installing JDK version ${VER_JDK} from: ${URL_JDK_DOWNLOAD}" ; install_tar_gz "${URL_JDK_DOWNLOAD}" && mv /opt/jdk* /opt/jdk && ln -sf /opt/jdk/bin/* /usr/bin/ ; - type java && echo "@ Version of Java (java): $(java -version)" || return -1 ; type javac && echo "@ Version of Java (javac): $(javac -version)" || return -1 ; } @@ -148,7 +145,6 @@ setup_java_maven() { && install_zip "${URL_MAVEN}" \ && mv "/opt/apache-maven-${VER_MAVEN}" /opt/maven \ && ln -sf /opt/maven/bin/mvn* /usr/bin/ ; - type mvn && echo "@ Version of Maven: $(mvn --version)" || return -1 ; } @@ -166,9 +162,9 @@ setup_node_base() { local VER_NODEJS=$(echo "${VERS_NODEJS}" | head -1) fi \ && [ -n "${VER_NODEJS}" ] \ - && local URL_NODEJS="https://nodejs.org/dist/v${VER_NODEJS}/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.xz" \ + && local URL_NODEJS="https://nodejs.org/dist/v${VER_NODEJS}/node-v${VER_NODEJS}-${UNAME}-${ARCH}.tar.gz" \ && echo "Downloading NodeJS version ${VER_NODEJS} from: ${URL_NODEJS}" \ - && install_tar_xz "${URL_NODEJS}" \ + && install_tar_gz "${URL_NODEJS}" \ && mv /opt/node* /opt/node \ && ln -sf /opt/node/bin/n* /usr/bin/ \ && echo 'export PATH=${PATH}:/opt/node/bin' | sudo tee -a /etc/profile.d/path-node.sh \ @@ -230,7 +226,6 @@ setup_node_bun() { && sudo ln -sf /opt/bun/bun /usr/bin/ \ && echo 'export PATH="${PATH}:/opt/bun"' | sudo tee -a /etc/profile.d/path-bun.sh \ && source /etc/profile.d/path-bun.sh ; - type bun && echo "@ Version of bun: $(bun -v)" || return $? ; } @@ -258,7 +253,6 @@ setup_GO() { && echo 'export GOPATH="$GOROOT/path"' | sudo tee -a /etc/profile.d/path-go.sh \ && echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' | sudo tee -a /etc/profile.d/path-go.sh \ && source /etc/profile.d/path-go.sh ; - type go && echo "@ Version of golang: $(go version)" || return -1 ; } @@ -272,7 +266,6 @@ setup_rust() { && echo 'export RUSTUP_HOME="/opt/rust"' | sudo tee -a /etc/profile.d/path-rust.sh > /dev/null \ && echo 'export PATH="$PATH:/opt/cargo/bin"' | sudo tee -a /etc/profile.d/path-rust.sh > /dev/null \ && source /etc/profile.d/path-rust.sh ; - type rustup && echo "@ Version of rustup: $(rustup --version)" || return -1 ; type rustc && echo "@ Version of rustc: $(rustc --version)" || return -1 ; } @@ -287,7 +280,6 @@ setup_R_base() { && R -e "install.packages(c('devtools'),clean=T,quiet=T);" \ && R -e "install.packages(c('devtools'),clean=T,quiet=F);" \ && ( type java && type R && R CMD javareconf || true ) ; - type R && echo "@ Version of R: $(R --version)" || return -1 ; } @@ -316,7 +308,6 @@ setup_julia() { && sudo mkdir -pv /opt/julia/pkg \ && echo "import Libdl; push!(Libdl.DL_LOAD_PATH, \"/opt/conda/lib\")" | sudo tee -a /opt/julia/etc/julia/startup.jl \ && echo "DEPOT_PATH[1]=\"/opt/julia/pkg\"" | sudo tee -a /opt/julia/etc/julia/startup.jl ; - type julia && echo "@ Version of Julia: $(julia --version)" || return -1 ; } @@ -339,7 +330,6 @@ setup_lua_base() { && sudo make linux test && sudo make install INSTALL_TOP=${LUA_HOME:-"/opt/lua"} \ && sudo ln -sf ${LUA_HOME:-"/opt/lua"}/bin/lua* /usr/bin/ \ && rm -rf /tmp/lua ; - type lua && echo "@ Version of LUA installed: $(lua -v)" || return -1 ; } @@ -363,7 +353,6 @@ setup_lua_rocks() { && sudo ./configure --prefix=${LUA_HOME:-"/opt/lua"} --with-lua-include=${LUA_HOME:-"/opt/lua"}/include && sudo make install \ && sudo ln -sf /opt/lua/bin/lua* /usr/bin/ \ && rm -rf /tmp/luarocks ; - type luarocks && echo "@ Version of luarocks: $(luarocks --version)" || return -1 ; } @@ -384,7 +373,6 @@ setup_bazel() { && local URL_BAZEL="https://github.com/bazelbuild/bazel/releases/download/${VER_BAZEL}/bazel-${VER_BAZEL}-installer-${UNAME}-${ARCH}.sh" \ && curl -o /tmp/bazel.sh -sL "${URL_BAZEL}" && chmod +x /tmp/bazel.sh \ && /tmp/bazel.sh && rm /tmp/bazel.sh ; - type bazel && echo "@ Version of bazel: $(bazel --version)" || return -1 ; } @@ -403,7 +391,6 @@ setup_gradle() { && local URL_GRADLE="https://downloads.gradle.org/distributions/gradle-${VER_GRADLE}-bin.zip" \ && mv /opt/gradle* /opt/gradle \ && ln -sf /opt/gradle/bin/gradle /usr/bin ; - type gradle && echo "@ Version of gradle: $(gradle --version)" || return -1 ; } @@ -426,6 +413,5 @@ setup_yq() { && install -m 0755 -D /tmp/yq /opt/bin/yq \ && ln -sf /opt/bin/yq /usr/bin/yq \ && rm -f /tmp/yq ; - - type yq && echo "@ Installed yq: $(yq --version)" + type yq && echo "@ Installed yq: $(yq --version)" ; } diff --git a/docker_atom/work/script-setup-db-clients.sh b/docker_atom/work/script-setup-db-clients.sh index 3f97ad0..c98e201 100644 --- a/docker_atom/work/script-setup-db-clients.sh +++ b/docker_atom/work/script-setup-db-clients.sh @@ -8,7 +8,6 @@ setup_postgresql_client() { echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list # will download ~9MB files and use ~55MB disk after installation sudo apt-get update && sudo apt-get -y install "postgresql-client-${VER_PG}" - type psql && echo "@ Version of psql client: $(psql --version)" || return -1 } @@ -33,7 +32,6 @@ setup_duckdb() { && mkdir -pv /opt/bin \ && install -m 0755 /tmp/duckdb /opt/bin/duckdb \ && rm -f "${TMP_FILE}" /tmp/duckdb ; - /opt/bin/duckdb --version && echo "@ DuckDB installed" || return -1 ; } diff --git a/docker_atom/work/script-setup-net.sh b/docker_atom/work/script-setup-net.sh index 13938d8..d6c7901 100644 --- a/docker_atom/work/script-setup-net.sh +++ b/docker_atom/work/script-setup-net.sh @@ -13,7 +13,6 @@ setup_traefik() { && curl -o /tmp/TMP.tgz -sL "${URL_TRAEFIK}" \ && mkdir -pv /opt/bin && tar -C /opt/bin -xzf /tmp/TMP.tgz traefik && rm /tmp/TMP.tgz \ && chmod +x /opt/bin/traefik && ln -sf /opt/bin/traefik /usr/bin/ ; - type traefik && echo "@ Version of traefik: $(traefik version)" || return -1 ; } @@ -34,7 +33,6 @@ setup_caddy() { && echo "Downloading Caddy ${VER_CADDY} from ${URL_CADDY}" \ && curl -o /tmp/TMP.tgz -sL "${URL_CADDY}" && tar -C /tmp/ -xzf /tmp/TMP.tgz && rm /tmp/TMP.tgz \ && mkdir -pv /opt/bin/ && mv /tmp/caddy /opt/bin/ && ln -sf /opt/bin/caddy /usr/local/bin/ ; - type caddy && echo "@ Version of caddy: $(caddy version)" || return -1 ; } @@ -59,7 +57,6 @@ setup_oauth2_proxy() { && tar -xzf /tmp/oauth2-proxy.tar.gz -C /tmp \ && install -m 0755 -D "/tmp/oauth2-proxy-v${VER_OAUTH2_PROXY}.linux-${ARCH}/oauth2-proxy" /opt/bin/oauth2-proxy \ && ln -sf /opt/bin/oauth2-proxy /usr/bin/oauth2-proxy \ - && rm -rf /tmp/oauth2-proxy* - - type oauth2-proxy && echo "@ Installed oauth2-proxy: $(oauth2-proxy --version)" + && rm -rf /tmp/oauth2-proxy* ; + type oauth2-proxy && echo "@ Installed oauth2-proxy: $(oauth2-proxy --version)" ; } diff --git a/docker_atom/work/script-setup-sys.sh b/docker_atom/work/script-setup-sys.sh index 6c54cce..4daf5ea 100644 --- a/docker_atom/work/script-setup-sys.sh +++ b/docker_atom/work/script-setup-sys.sh @@ -16,7 +16,6 @@ setup_tini() { && URL_TINI="https://github.com/krallin/tini/releases/download/v${VER_TINI}/tini-${ARCH}" \ && echo "Downloading Tini ${VER_TINI} from ${URL_TINI}" \ && curl -o /usr/bin/tini -sL $URL_TINI && chmod +x /usr/bin/tini ; - type tini && echo "@ Version of tini: $(tini --version)" || return -1 ; # ref: https://cloud-atlas.readthedocs.io/zh-cn/latest/docker/init/docker_tini.html # to run multi-proces with tini: use a bash script ends with the following code @@ -41,7 +40,6 @@ setup_supervisord() { && echo "Downloading Supervisord ${VER_SUPERVISORD} from ${URL_SUPERVISORD}" \ && curl -o /tmp/TMP.tgz -sL $URL_SUPERVISORD && tar -C /tmp/ -xzf /tmp/TMP.tgz && rm /tmp/TMP.tgz \ && mkdir -pv /opt/bin/ && mv /tmp/supervisord /opt/bin/ && ln -sf /opt/bin/supervisord /usr/local/bin/ ; - type supervisord && echo "@ Version of supervisord: $(supervisord version)" || return -1 ; }