From 0283985094bbc24a01dfc86d14d5cd6f5f027d2e Mon Sep 17 00:00:00 2001 From: JianFeeeee Date: Fri, 11 Sep 2026 10:59:33 +0800 Subject: [PATCH] fix(docker): retry apt-get to tolerate transient proxy 502s MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 构建时遇到 'E: Failed to fetch ... 502 Bad Gateway [IP: 127.0.0.1 7890]': 经代理拉 Debian 包偶发上游抖动。给三处 apt-get 统一加 Acquire::Retries=5 与 http 超时,避免一次网络抖动就让整个 (含耗时较久的 SearXNG 构建阶段)前功尽弃。 --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2d407e0..de3a74f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -25,7 +25,8 @@ ENV https_proxy=${HTTPS_PROXY} ENV HTTP_PROXY=${HTTP_PROXY} ENV HTTPS_PROXY=${HTTPS_PROXY} -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \ + && apt-get -o Acquire::Retries=5 install -y --no-install-recommends \ python3 python3-pip python3-venv git ca-certificates \ && rm -rf /var/lib/apt/lists/* @@ -41,7 +42,8 @@ RUN git clone --depth 1 https://github.com/searxng/searxng.git /src/searxng \ # 供 /extension/install.html 下载(Chromium 用 zip,Firefox 用 xpi) FROM debian:bookworm-slim AS extpack -RUN apt-get update && apt-get install -y --no-install-recommends zip ca-certificates \ +RUN apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \ + && apt-get -o Acquire::Retries=5 install -y --no-install-recommends zip ca-certificates \ && rm -rf /var/lib/apt/lists/* COPY extension/chrome /src/chrome @@ -56,7 +58,8 @@ FROM debian:bookworm-slim ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get -o Acquire::Retries=5 -o Acquire::http::Timeout=30 update \ + && apt-get -o Acquire::Retries=5 install -y --no-install-recommends \ nginx python3 supervisor curl ca-certificates git \ && rm -rf /var/lib/apt/lists/*