Просмотр исходного кода

fix(docker): 解决 PPA 超时和 Python 版本问题

- 移除 ubuntu-toolchain-r PPA 添加,Ubuntu 24.04 自带 GCC 14 足够
- 默认 Python 改为 3.12(Ubuntu 24.04 自带,跳过 deadsnakes PPA)
- deadsnakes PPA 改用 USTC 代理源,绕过 add-apt-repository 超时
- 添加 USTC 代理到 /etc/apt/sources.list 中的 PPA 引用
kinglee 2 недель назад
Родитель
Сommit
c48b4e2860
1 измененных файлов с 14 добавлено и 9 удалено
  1. 14 9
      pack/Dockerfile

+ 14 - 9
pack/Dockerfile

@@ -20,7 +20,7 @@
 # - GPUSTACK_RUNTIME_DOCKER_MIRRORED_NAME_FILTER_LABELS: Semicolon-separated list of labels to filter mirrored images when deploying mirrored deployment.
 # - HIGRESS_VERSION: Version of Higress to use.
 # - HIGRESS_APISERVER_VERSION: Version of Higress API server to use.
-ARG PYTHON_VERSION=3.11
+ARG PYTHON_VERSION=3.12
 ARG GPUSTACK_BASE_IMAGE=base
 ARG GPUSTACK_RUNTIME_ROCM_VERSION=7.0.2
 ARG GPUSTACK_RUNTIME_DOCKER_MIRRORED_NAME_FILTER_LABELS
@@ -59,14 +59,12 @@ RUN <<EOF
     # Use Tsinghua mirrors for Ubuntu
     sed -i 's|//archive.ubuntu.com|//mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
     sed -i 's|//security.ubuntu.com|//mirrors.tuna.tsinghua.edu.cn|g' /etc/apt/sources.list
+    sed -i 's|//ppa.launchpadcontent.net|//launchpad.proxy.ustclug.org|g' /etc/apt/sources.list
 
     # Refresh
     apt-get update -y && apt-get install -y --no-install-recommends \
         software-properties-common apt-transport-https \
         ca-certificates gnupg2 lsb-release gnupg-agent \
-      && apt-get update -y \
-      && add-apt-repository -y ppa:ubuntu-toolchain-r/test \
-      && sed -i 's|ppa.launchpadcontent.net|launchpad.proxy.ustclug.org|g' /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources 2>/dev/null; true \
       && apt-get update -y
 
     # Install
@@ -179,11 +177,18 @@ RUN <<EOF
         exit 0
     fi
 
-    # Add deadsnakes PPA for Python versions
-    for i in 1 2 3; do
-        add-apt-repository -y ppa:deadsnakes/ppa && break || { echo "Attempt $i failed, retrying in 5s..."; sleep 5; }
-    done
-    sed -i 's|ppa.launchpadcontent.net|launchpad.proxy.ustclug.org|g' /etc/apt/sources.list.d/*.list /etc/apt/sources.list.d/*.sources 2>/dev/null || true
+    # Add deadsnakes PPA via USTC mirror (bypass add-apt-repository which connects to launchpad)
+    CODENAME=$(. /etc/os-release && echo "$VERSION_CODENAME")
+    wget -q -O /tmp/deadsnakes.asc https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x6c7c47c706f57f28c70139e07965b5db433a593c
+    gpg --dearmor /tmp/deadsnakes.asc
+    mv /tmp/deadsnakes.asc.gpg /usr/share/keyrings/deadsnakes.gpg
+    cat > /etc/apt/sources.list.d/deadsnakes-ubuntu-ppa-${CODENAME}.sources <<SRCEOF
+Types: deb
+URIs: https://launchpad.proxy.ustclug.org/deadsnakes/ppa/ubuntu
+Suites: ${CODENAME}
+Components: main
+Signed-By: /usr/share/keyrings/deadsnakes.gpg
+SRCEOF
     apt-get update -y
 
     # Install