From 76aba35d0d669445bee7585671901b33fd7a7498 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 Mar 2024 18:07:03 +0800 Subject: [PATCH 1/5] update os ver --- docker_atom/Dockerfile | 3 ++- docker_atom/work/script-setup.sh | 26 +++++++++++++------------- tool.sh | 13 ------------- 3 files changed, 15 insertions(+), 27 deletions(-) diff --git a/docker_atom/Dockerfile b/docker_atom/Dockerfile index bbb3778..3481136 100644 --- a/docker_atom/Dockerfile +++ b/docker_atom/Dockerfile @@ -1,7 +1,7 @@ # Distributed under the terms of the Modified BSD License. # latest # default value: Latest LTS version of Ubuntu (https://hub.docker.com/_/ubuntu) -ARG BASE_IMG="ubuntu:focal" +ARG BASE_IMG="ubuntu:jammy" FROM ${BASE_IMG} LABEL maintainer="haobibo@gmail.com" @@ -35,6 +35,7 @@ RUN set -x && cd /tmp \ && echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && mv /root/.bashrc /etc/bash_profile \ && echo '[ $BASH ] && [ -f /etc/bash_profile ] && . /etc/bash_profile' >> /etc/bash.bashrc \ + && echo '[ $BASH ] && [ -f /etc/profile ] && . /etc/profile' >> /etc/bash.bashrc \ && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean diff --git a/docker_atom/work/script-setup.sh b/docker_atom/work/script-setup.sh index 3703391..11ed2ae 100644 --- a/docker_atom/work/script-setup.sh +++ b/docker_atom/work/script-setup.sh @@ -186,6 +186,19 @@ setup_GO() { } +setup_rust() { + export CARGO_HOME=/opt/cargo \ + && export RUSTUP_HOME=/opt/rust \ + && export PATH=$PATH:${CARGO_HOME}/bin \ + && curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable \ + && echo 'export CARGO_HOME="/opt/cargo"' >> /etc/profile \ + && echo 'export RUSTUP_HOME="/opt/rust"' >> /etc/profile \ + && echo 'export PATH=$PATH:/opt/cargo/bin' >> /etc/profile \ + && echo "@ Version of rustup: $(rustup --version)" \ + && echo "@ Version of rustc: $(rustc --version)" +} + + setup_julia() { JULIA_URL="https://julialangnightlies-s3.julialang.org/bin/linux/x64/julia-latest-linux64.tar.gz" \ && install_tar_gz $JULIA_URL \ @@ -207,19 +220,6 @@ setup_traefik() { } -setup_rust() { - export CARGO_HOME=/opt/cargo \ - && export RUSTUP_HOME=/opt/rust \ - && export PATH=$PATH:${CARGO_HOME}/bin \ - && curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable \ - && echo 'export CARGO_HOME="/opt/cargo"' >> /etc/profile \ - && echo 'export RUSTUP_HOME="/opt/rust"' >> /etc/profile \ - && echo 'export PATH=$PATH:/opt/cargo/bin' >> /etc/profile \ - && echo "@ Version of rustup: $(rustup --version)" \ - && echo "@ Version of rustc: $(rustc --version)" -} - - setup_bazel() { BAZEL_VERSION=$(curl -sL https://github.com/bazelbuild/bazel/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[\d.]+' ) \ && BAZEL_URL="https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-installer-linux-x86_64.sh" \ diff --git a/tool.sh b/tool.sh index d3af3e4..e9dbebd 100755 --- a/tool.sh +++ b/tool.sh @@ -78,19 +78,6 @@ clear_images() { docker image prune --force && docker images ; } -setup_docker_syncer() { - ARCH="amd64" \ - && SYNCER_VERSION="$(curl -sL https://github.com/AliyunContainerService/image-syncer/releases.atom | grep 'releases/tag' | head -1 | grep -Po '\d[.\d]+')" \ - && SYNCER_URL="https://github.com/AliyunContainerService/image-syncer/releases/download/v${SYNCER_VERSION}/image-syncer-v${SYNCER_VERSION}-linux-${ARCH}.tar.gz" \ - && echo "Downloading image-syncer from: ${SYNCER_URL}" \ - && curl -o /tmp/image_syncer.tgz -sL ${SYNCER_URL} \ - && mkdir -pv /tmp/image_syncer && tar -zxvf /tmp/image_syncer.tgz -C /tmp/image_syncer \ - && sudo chmod +x /tmp/image_syncer/image-syncer \ - && sudo mv /tmp/image_syncer/image-syncer /usr/bin/ \ - && rm -rf /tmp/image_syncer* \ - && echo "@ image-syncer installed to: $(which image-syncer)" -} - remove_folder() { sudo du -h -d1 "$1" || true ; From 45b34b5307184f13d072a43adec9c2ee7b4440f2 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 Mar 2024 11:18:52 +0000 Subject: [PATCH 2/5] debug --- docker_atom/Dockerfile | 2 +- docker_base/Dockerfile | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docker_atom/Dockerfile b/docker_atom/Dockerfile index 3481136..5127110 100644 --- a/docker_atom/Dockerfile +++ b/docker_atom/Dockerfile @@ -35,8 +35,8 @@ RUN set -x && cd /tmp \ && echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && mv /root/.bashrc /etc/bash_profile \ && echo '[ $BASH ] && [ -f /etc/bash_profile ] && . /etc/bash_profile' >> /etc/bash.bashrc \ - && echo '[ $BASH ] && [ -f /etc/profile ] && . /etc/profile' >> /etc/bash.bashrc \ && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ + && echo '[ $BASH ] && [ -f /etc/profile ] && echo "exec /etc/profile"' >> /etc/profile \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean diff --git a/docker_base/Dockerfile b/docker_base/Dockerfile index 9343002..19101c0 100644 --- a/docker_base/Dockerfile +++ b/docker_base/Dockerfile @@ -25,6 +25,8 @@ RUN set -x && source /opt/utils/script-setup.sh \ && echo "/usr/share/pyshared/" >> "${PYTHON_PTH_FILE}" \ && echo "/usr/share/python3/" >> "${PYTHON_PTH_FILE}" \ && rm -rf $(/usr/bin/python3 -c 'import sys; print(" ".join(i for i in sys.path if "python" in i))') /usr/bin/python3* \ + && rm -rf "${CONDA_PREFIX}"/lib/python3.1 /usr/lib/python${PYTHON_VERSION} \ + && ln -sf "${CONDA_PREFIX}"/lib/python${PYTHON_VERSION} /usr/lib/ \ && ln -sf "${CONDA_PREFIX}"/bin/python3.* /usr/bin/ \ && ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python \ && ln -sf /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 \ From b477c61e6fb02bbabc83f0fff1342f4679968849 Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 Mar 2024 11:56:07 +0000 Subject: [PATCH 3/5] debug paths --- docker_atom/Dockerfile | 5 ++--- docker_atom/work/script-setup.sh | 18 +++++++++--------- docker_base/Dockerfile | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/docker_atom/Dockerfile b/docker_atom/Dockerfile index 5127110..c7b4e65 100644 --- a/docker_atom/Dockerfile +++ b/docker_atom/Dockerfile @@ -33,10 +33,9 @@ RUN set -x && cd /tmp \ && localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8 \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen \ && echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ - && mv /root/.bashrc /etc/bash_profile \ - && echo '[ $BASH ] && [ -f /etc/bash_profile ] && . /etc/bash_profile' >> /etc/bash.bashrc \ + && mv /root/.bashrc /etc/profile.d/bash.bashrc \ + && echo '[ $BASH ] && [ -f /etc/profile ] && . /etc/profile' >> /etc/bash.bashrc \ && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ - && echo '[ $BASH ] && [ -f /etc/profile ] && echo "exec /etc/profile"' >> /etc/profile \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean diff --git a/docker_atom/work/script-setup.sh b/docker_atom/work/script-setup.sh index 11ed2ae..16f2c13 100644 --- a/docker_atom/work/script-setup.sh +++ b/docker_atom/work/script-setup.sh @@ -29,7 +29,7 @@ trusted-host=pypi.python.org pypi.org files.pythonhosted.org EOF fi - echo 'export PATH=${PATH}:${CONDA_PREFIX:-"/opt/conda"}/bin' >> /etc/profile + echo 'export PATH=${PATH}:${CONDA_PREFIX:-"/opt/conda"}/bin' >> /etc/profile.d/path-conda.sh ln -sf "${CONDA_PREFIX}/bin/conda" /usr/bin/ conda config --system --prepend channels conda-forge \ @@ -141,7 +141,7 @@ setup_node() { && install_tar_gz ${NODEJS_URL} \ && mv /opt/node* /opt/node \ && ln -sf /opt/node/bin/n* /usr/bin/ \ - && echo 'export PATH=${PATH}:/opt/node/bin' >> /etc/profile \ + && echo 'export PATH=${PATH}:/opt/node/bin' >> /etc/profile.d/path-node.sh \ && npm install -g npm \ && echo "@ Version of Node and npm: $(node -v) $(npm -v)" \ && corepack enable && yarn set version stable \ @@ -178,10 +178,10 @@ setup_GO() { && GO_URL="https://dl.google.com/go/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz" \ && install_tar_gz "${GO_URL}" go \ && ln -sf /opt/go/bin/go* /usr/bin/ \ - && echo 'export GOROOT="/opt/go"' >> /etc/profile \ - && echo 'export GOBIN="$GOROOT/bin"' >> /etc/profile \ - && echo 'export GOPATH="$GOROOT/path"' >> /etc/profile \ - && echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /etc/profile \ + && echo 'export GOROOT="/opt/go"' >> /etc/profile.d/path-go.sh \ + && echo 'export GOBIN="$GOROOT/bin"' >> /etc/profile.d/path-go.sh \ + && echo 'export GOPATH="$GOROOT/path"' >> /etc/profile.d/path-go.sh \ + && echo 'export PATH=$PATH:$GOROOT/bin:$GOPATH/bin' >> /etc/profile.d/path-go.sh \ && echo "@ Version of golang: $(go version)" } @@ -191,9 +191,9 @@ setup_rust() { && export RUSTUP_HOME=/opt/rust \ && export PATH=$PATH:${CARGO_HOME}/bin \ && curl -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path --profile minimal --default-toolchain stable \ - && echo 'export CARGO_HOME="/opt/cargo"' >> /etc/profile \ - && echo 'export RUSTUP_HOME="/opt/rust"' >> /etc/profile \ - && echo 'export PATH=$PATH:/opt/cargo/bin' >> /etc/profile \ + && echo 'export CARGO_HOME="/opt/cargo"' >> /etc/profile.d/path-rust.sh \ + && echo 'export RUSTUP_HOME="/opt/rust"' >> /etc/profile.d/path-rust.sh \ + && echo 'export PATH=$PATH:/opt/cargo/bin' >> /etc/profile.d/path-rust.sh \ && echo "@ Version of rustup: $(rustup --version)" \ && echo "@ Version of rustc: $(rustc --version)" } diff --git a/docker_base/Dockerfile b/docker_base/Dockerfile index 19101c0..77cb0ed 100644 --- a/docker_base/Dockerfile +++ b/docker_base/Dockerfile @@ -8,9 +8,9 @@ LABEL maintainer="haobibo@gmail.com" ARG PYTHON_VERSION="3.11" ENV CONDA_PREFIX=/opt/conda -ENV PATH=$PATH:${CONDA_PREFIX}/bin RUN set -x && source /opt/utils/script-setup.sh \ + && export PATH=$PATH:${CONDA_PREFIX}/bin \ # update source for CMake && curl -sL https://apt.kitware.com/keys/kitware-archive-latest.asc | sudo sudo tee /etc/apt/trusted.gpg.d/kitware.asc \ && echo "deb https://apt.kitware.com/ubuntu/ $(lsb_release -cs) main" > /etc/apt/sources.list.d/kitware.list \ From 9452fc8fe18af56450e84449b61e868d95b5c09e Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 Mar 2024 12:22:56 +0000 Subject: [PATCH 4/5] debug var in profile --- .github/workflows/build-docker.yml | 14 ++++++++++++-- docker_atom/Dockerfile | 7 +++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index 2346932..5309ead 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -28,17 +28,27 @@ env: jobs: qpod_base: - name: 'atom,base,python-3.7,python-3.11,python-3.12' + name: 'atom,base,python-3.11' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - run: | source ./tool.sh build_image atom latest docker_atom/Dockerfile && push_image - build_image python-3.7 latest docker_base/Dockerfile --build-arg "PYTHON_VERSION=3.7" && push_image build_image python-3.11 latest docker_base/Dockerfile --build-arg "PYTHON_VERSION=3.11" && alias_image python-3.11 latest base latest && push_image + + qpod_python: + name: 'python-3.7,python-3.12' + needs: 'qpod_base' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: | + source ./tool.sh + build_image python-3.7 latest docker_base/Dockerfile --build-arg "PYTHON_VERSION=3.7" && push_image build_image python-3.12 latest docker_base/Dockerfile --build-arg "PYTHON_VERSION=3.12" && push_image + qpod_core: name: 'core' needs: qpod_base diff --git a/docker_atom/Dockerfile b/docker_atom/Dockerfile index c7b4e65..c7b763b 100644 --- a/docker_atom/Dockerfile +++ b/docker_atom/Dockerfile @@ -34,8 +34,11 @@ RUN set -x && cd /tmp \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen \ && echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && mv /root/.bashrc /etc/profile.d/bash.bashrc \ - && echo '[ $BASH ] && [ -f /etc/profile ] && . /etc/profile' >> /etc/bash.bashrc \ - && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ + # Add a check variable `ENTER_PROFILE` to see if /etc/profile is executed or not + && echo 'export ENTER_PROFILE=$(date +%Y.%m%d.%H%M)' >> /etc/profile \ + # if /etc/profile haven't been executed, execute it. + && echo '[ $BASH ] && [ -f /etc/profile ] && [ -z $ENTER_PROFILE ] && . /etc/profile' >> /etc/bash.bashrc \ + && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean From 7a6b65a01ab4f53e4403498a48db81d3b3f559df Mon Sep 17 00:00:00 2001 From: Bibo Hao Date: Tue, 12 Mar 2024 13:33:57 +0000 Subject: [PATCH 5/5] debug vars --- docker_atom/Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docker_atom/Dockerfile b/docker_atom/Dockerfile index c7b763b..a6eb488 100644 --- a/docker_atom/Dockerfile +++ b/docker_atom/Dockerfile @@ -34,11 +34,13 @@ RUN set -x && cd /tmp \ && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && locale-gen \ && echo "ALL ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers \ && mv /root/.bashrc /etc/profile.d/bash.bashrc \ + && LINE_SET_FLAG='export ENTER_PROFILE=$(date +%Y.%m%d.%H%M)' \ + && LINE_CHK_FLAG='[ $BASH ] && [ -f /etc/profile ] && [ -z $ENTER_PROFILE ] && . /etc/profile' \ # Add a check variable `ENTER_PROFILE` to see if /etc/profile is executed or not - && echo 'export ENTER_PROFILE=$(date +%Y.%m%d.%H%M)' >> /etc/profile \ + && echo -e "${LINE_SET_FLAG} \n$(cat /etc/profile)" > /etc/profile \ # if /etc/profile haven't been executed, execute it. - && echo '[ $BASH ] && [ -f /etc/profile ] && [ -z $ENTER_PROFILE ] && . /etc/profile' >> /etc/bash.bashrc \ - && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ + && echo -e "${LINE_CHK_FLAG} \n$(cat /etc/bash.bashrc)" > /etc/bash.bashrc \ + && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ # Clean up and display components version information... && source /opt/utils/script-utils.sh && install__clean