From aa99eb932e39ed4c8ec314ecdaf1272b0af62d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E6=9C=A8?= <594326199@qq.com> Date: Fri, 27 Nov 2026 15:29:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E9=83=A8=E7=BD=B2):=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E5=8F=AF=E7=94=A8=20Debian=20=E9=95=9C=E5=83=8F=E5=B9=B6?= =?UTF-8?q?=E9=87=8D=E8=AF=95=E4=BE=9D=E8=B5=96=E5=AE=89=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 切换腾讯 Debian 镜像并为 apt 依赖安装增加续传重试。 Co-authored-by: 苏木 <594326199@qq.com> Co-committed-by: 苏木 <594326199@qq.com> --- deploy/Dockerfile | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/deploy/Dockerfile b/deploy/Dockerfile index f757cf83..a4c4e61e 100644 --- a/deploy/Dockerfile +++ b/deploy/Dockerfile @@ -1,14 +1,15 @@ FROM m.daocloud.io/docker.io/library/php:8.3.36-apache-bookworm@sha256:cbd3b3d9011668443d54ab40ec31db56c73d91b4c8198935d639aa80d2d815c1 AS php-base -# 国内构建机访问 deb.debian.org 常被代理拦截(502),统一改用清华 Debian 镜像。 +# 国内构建机访问 Debian 官方源常被代理拦截(502),统一改用腾讯云镜像。 RUN set -eu; \ for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources /etc/apt/sources.list.d/*.list; do \ [ -f "$f" ] || continue; \ - sed -i 's|deb.debian.org|mirrors.tuna.tsinghua.edu.cn|g; s|security.debian.org|mirrors.tuna.tsinghua.edu.cn|g' "$f"; \ + sed -i 's|deb.debian.org|mirrors.cloud.tencent.com|g; s|security.debian.org|mirrors.cloud.tencent.com|g; s|http://mirrors.cloud.tencent.com|https://mirrors.cloud.tencent.com|g' "$f"; \ done -RUN apt-get -o Acquire::Retries=3 update \ - && apt-get -o Acquire::Retries=3 install -y --no-install-recommends \ +RUN set -eu; \ + apt-get -o Acquire::Retries=5 update; \ + apt_packages="\ curl \ libcurl4-openssl-dev \ libfreetype6-dev \ @@ -29,8 +30,17 @@ RUN apt-get -o Acquire::Retries=3 update \ freetds-dev \ tdsodbc \ unixodbc-dev \ - unzip \ - && docker-php-ext-configure gd --with-freetype --with-jpeg \ + unzip"; \ + attempt=1; \ + while ! apt-get -o Acquire::Retries=5 install -y --no-install-recommends $apt_packages; do \ + if [ "$attempt" -ge 3 ]; then \ + exit 1; \ + fi; \ + attempt=$((attempt + 1)); \ + sleep 3; \ + apt-get -o Acquire::Retries=5 update; \ + done; \ + docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-configure pdo_odbc --with-pdo-odbc=unixODBC,/usr \ && docker-php-ext-install -j2 \ bcmath \