From 669c4338e0c14605ac5a4e1de7b559414a705281 Mon Sep 17 00:00:00 2001 From: lijiakun Date: Sat, 16 Aug 2025 19:13:19 +0800 Subject: [PATCH] [bugfix] add timeout for wget --- Dockerfile | 8 ++++---- build_image.sh | 2 +- install_depend_pkgs.sh | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index f579daff0..519701627 100644 --- a/Dockerfile +++ b/Dockerfile @@ -78,7 +78,7 @@ RUN set -ex && \ WORKDIR /root RUN set -ex && \ - wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py311_25.1.1-2-Linux-${ARCH}.sh && \ + wget --timeout=30 --tries=3 https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py311_25.1.1-2-Linux-${ARCH}.sh && \ bash /root/Miniconda3-py311_25.1.1-2-Linux-${ARCH}.sh -b && \ rm /root/Miniconda3-py311_25.1.1-2-Linux-${ARCH}.sh @@ -101,9 +101,9 @@ RUN set -ex && \ echo "Driver_Install_Status=complete" >> /etc/ascend_install.info RUN set -ex && \ - curl -s -k "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-toolkit_8.1.RC1_linux-${ARCH}.run" -o Ascend-cann-toolkit.run && \ - curl -s -k "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-kernels-910b_8.1.RC1_linux-${ARCH}.run" -o Ascend-cann-kernels-910b.run && \ - curl -s -k "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-nnrt_8.1.RC1_linux-${ARCH}.run" -o Ascend-cann-nnrt.run && \ + wget --no-check-certificate --quiet --timeout=30 --tries=3 "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-toolkit_8.1.RC1_linux-${ARCH}.run" -O Ascend-cann-toolkit.run && \ + wget --no-check-certificate --quiet --timeout=30 --tries=3 "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-kernels-910b_8.1.RC1_linux-${ARCH}.run" -O Ascend-cann-kernels-910b.run && \ + wget --no-check-certificate --quiet --timeout=30 --tries=3 "https://ascend-repo.obs.cn-east-2.myhuaweicloud.com/CANN/CANN%208.1.RC1/Ascend-cann-nnrt_8.1.RC1_linux-${ARCH}.run" -O Ascend-cann-nnrt.run && \ chmod a+x *.run && \ bash /root/Ascend-cann-toolkit.run --install -q && \ bash /root/Ascend-cann-kernels-910b.run --install -q && \ diff --git a/build_image.sh b/build_image.sh index 37589f9d1..faacaba6c 100644 --- a/build_image.sh +++ b/build_image.sh @@ -28,7 +28,7 @@ main() { log "Starting Docker image build process" log "Step 1: Building base environment for $ARCH" - docker image inspect base_env >/dev/null 2>&1 || docker build --build-arg TARGETARCH=$ARCH -t base_env -f Dockerfile . + docker image inspect base_env >/dev/null 2>&1 || docker build --build-arg ARCH=$ARCH -t base_env -f Dockerfile . log "Step 2: Building final image with install script" diff --git a/install_depend_pkgs.sh b/install_depend_pkgs.sh index 01060e7b3..98a18e683 100644 --- a/install_depend_pkgs.sh +++ b/install_depend_pkgs.sh @@ -95,9 +95,9 @@ get_package_url() { if [[ "$package" == "mindspore" ]]; then local python_v="cp$(python3 --version 2>&1 | grep -oP 'Python \K\d+\.\d+' | tr -d .)" - local wheel_url=$(curl -k -s "$base_url" | sed -n 's/.*href="\([^"]*\.whl\)".*/\1/p' | grep -v sha256 | grep "${python_v}-${python_v}" | head -n 1) + local wheel_url=$(wget --no-check-certificate --quiet --timeout=30 --tries=3 -O - "$base_url" | sed -n 's/.*href="\([^"]*\.whl\)".*/\1/p' | grep -v sha256 | grep "${python_v}-${python_v}" | head -n 1) else - local wheel_url=$(curl -k -s "$base_url" | sed -n 's/.*href="\([^"]*\.whl\)".*/\1/p' | grep -v sha256 | head -n 1) + local wheel_url=$(wget --no-check-certificate --quiet --timeout=30 --tries=3 -O - "$base_url" | sed -n 's/.*href="\([^"]*\.whl\)".*/\1/p' | grep -v sha256 | head -n 1) fi echo "${base_url}${wheel_url}" -- Gitee