From 71211bc68d032b52c719225146bdb130eb8db8d3 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 16 Jul 2026 18:03:09 +0800 Subject: [PATCH] =?UTF-8?q?chore(docker):=20GitHub=20Releases=20=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E8=B5=B0=20gh-proxy=20=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit dx tarball 与 tailwindcss 二进制都在 github.com releases 上,国内下载 ~300KB/s 且频繁连接重置。新增 ARG GH_PROXY (默认 https://gh-proxy.com) 前缀到两处 GitHub 下载 URL;传空值可回退直连,便于非大陆环境构建。 --- Dockerfile | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 088aa12..4825286 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,12 @@ ARG DEBIAN_SECURITY_MIRROR=https://mirrors.tuna.tsinghua.edu.cn/debian-security ARG NODE_MIRROR=https://registry.npmmirror.com/-/binary/node ARG NPM_REGISTRY=https://registry.npmmirror.com ARG RS_PROXY=https://rsproxy.cn +# GitHub Releases proxy — the dx tarball and tailwindcss binary live on +# github.com releases and download at ~300 KB/s with frequent connection +# resets from China. Prefixing the raw github.com URL routes the download +# through the proxy. Set to "" (empty) to bypass the proxy (e.g. building +# outside China where github.com is fast/reliable). +ARG GH_PROXY=https://gh-proxy.com # --- Debian apt: rewrite the DEB822 sources to the TUNA mirror. --- RUN sed -i \ @@ -103,7 +109,7 @@ RUN ARCH="$(dpkg --print-architecture)" \ arm64) DX_TRIPLET=aarch64-unknown-linux-gnu DX_SHA256=8cf14db0b11b43b31dd6d39e71b00e567f2fccfde85ae3a8f7ef0f8745e5ccfb ;; \ *) echo "unsupported arch: $ARCH" >&2; exit 1 ;; \ esac \ - && DX_URL="https://github.com/DioxusLabs/dioxus/releases/download/v${DX_VERSION}/dx-${DX_TRIPLET}.tar.gz" \ + && DX_URL="${GH_PROXY:+${GH_PROXY}/}https://github.com/DioxusLabs/dioxus/releases/download/v${DX_VERSION}/dx-${DX_TRIPLET}.tar.gz" \ && curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors --retry-connrefused --continue-at - "${DX_URL}" -o /tmp/dx.tar.gz \ && echo "${DX_SHA256} /tmp/dx.tar.gz" | sha256sum -c - \ && tar -xzf /tmp/dx.tar.gz -C /usr/local/bin \ @@ -119,7 +125,7 @@ RUN ARCH="$(dpkg --print-architecture)" \ arm64) TW_ARCH=arm64 ;; \ *) echo "unsupported arch: $ARCH" >&2; exit 1 ;; \ esac \ - && GH_URL="https://github.com/tailwindlabs/tailwindcss/releases/download/v${TAILWIND_VERSION}/tailwindcss-linux-${TW_ARCH}" \ + && GH_URL="${GH_PROXY:+${GH_PROXY}/}https://github.com/tailwindlabs/tailwindcss/releases/download/v${TAILWIND_VERSION}/tailwindcss-linux-${TW_ARCH}" \ && curl -fsSL -o /usr/local/bin/tailwindcss "${GH_URL}" \ && chmod +x /usr/local/bin/tailwindcss