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 bbb3778..a6eb488 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" @@ -33,9 +33,14 @@ 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 \ - && echo '[ $BASH ] && [ -f /root/.bashrc ] && . /root/.bashrc' >> /etc/bash.bashrc \ + && 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 -e "${LINE_SET_FLAG} \n$(cat /etc/profile)" > /etc/profile \ + # if /etc/profile haven't been executed, execute it. + && 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 diff --git a/docker_atom/work/script-setup.sh b/docker_atom/work/script-setup.sh index 3703391..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,14 +178,27 @@ 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)" } +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.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)" +} + + 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/docker_base/Dockerfile b/docker_base/Dockerfile index 9343002..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 \ @@ -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 \ 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 ;