From 3204ecf4a57fcd45ae5cabbc93f6b8c3b1dfd382 Mon Sep 17 00:00:00 2001 From: Dmitriy Petrov Date: Sun, 9 Aug 2026 13:33:28 +0300 Subject: [PATCH] Retry sing-box downloads in runtime builds --- Dockerfile | 2 +- Dockerfile.client | 2 +- Dockerfile.runtime-base | 2 +- src/shared/versions.ts | 4 ++-- test/server/compiled-entrypoint.test.js | 9 +++++++++ 5 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 16b86e9..a50a594 100644 --- a/Dockerfile +++ b/Dockerfile @@ -35,7 +35,7 @@ RUN if [ "${INSTALL_SINGBOX}" = "true" ]; then \ arm64) sb_arch="arm64" ;; \ *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ esac; \ - curl -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ + curl --retry 5 --retry-all-errors --retry-delay 2 -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ tar -xzf /tmp/sing-box.tgz -C /tmp; \ mv "/tmp/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}/sing-box" /usr/local/bin/sing-box; \ chmod +x /usr/local/bin/sing-box; \ diff --git a/Dockerfile.client b/Dockerfile.client index 2843f14..a960838 100644 --- a/Dockerfile.client +++ b/Dockerfile.client @@ -26,7 +26,7 @@ RUN set -eux; \ arm64) sb_arch="arm64" ;; \ *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ esac; \ - curl -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ + curl --retry 5 --retry-all-errors --retry-delay 2 -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ tar -xzf /tmp/sing-box.tgz -C /tmp; \ mv "/tmp/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}/sing-box" /usr/local/bin/sing-box; \ chmod +x /usr/local/bin/sing-box; \ diff --git a/Dockerfile.runtime-base b/Dockerfile.runtime-base index 4014b30..3e5c6be 100644 --- a/Dockerfile.runtime-base +++ b/Dockerfile.runtime-base @@ -45,7 +45,7 @@ RUN set -eux; \ arm64) sb_arch="arm64" ;; \ *) echo "Unsupported architecture: $arch" >&2; exit 1 ;; \ esac; \ - curl -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ + curl --retry 5 --retry-all-errors --retry-delay 2 -fsSL "https://github.com/SagerNet/sing-box/releases/download/v${SINGBOX_VERSION}/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}.tar.gz" -o /tmp/sing-box.tgz; \ tar -xzf /tmp/sing-box.tgz -C /tmp; \ mv "/tmp/sing-box-${SINGBOX_VERSION}-linux-${sb_arch}/sing-box" /usr/local/bin/sing-box; \ chmod +x /usr/local/bin/sing-box; \ diff --git a/src/shared/versions.ts b/src/shared/versions.ts index 26a4367..cf6fabb 100644 --- a/src/shared/versions.ts +++ b/src/shared/versions.ts @@ -1,7 +1,7 @@ export const HARBOR_VERSIONS = Object.freeze({ - macClient: '0.21.4', + macClient: '0.21.5', gatewayClient: '0.22.0', - gatewayBackend: '0.22.4', + gatewayBackend: '0.22.5', }); export interface ParsedVersion { diff --git a/test/server/compiled-entrypoint.test.js b/test/server/compiled-entrypoint.test.js index 9b8669c..cd8561d 100644 --- a/test/server/compiled-entrypoint.test.js +++ b/test/server/compiled-entrypoint.test.js @@ -170,3 +170,12 @@ test('every shipped build defaults to sing-box 1.13.18', () => { assert.match(fs.readFileSync(path.join(root, file), 'utf8'), /SINGBOX_VERSION[^\n]*1\.13\.18/); } }); + +test('runtime builds retry transient sing-box release download failures', () => { + for (const file of ['Dockerfile', 'Dockerfile.client', 'Dockerfile.runtime-base']) { + assert.match( + fs.readFileSync(path.join(root, file), 'utf8'), + /curl --retry 5 --retry-all-errors --retry-delay 2 -fsSL .*SagerNet\/sing-box/, + ); + } +});