mirror of
https://github.com/dockersrc/go
synced 2026-06-24 20:01:07 -04:00
🐛 Retry GitHub API calls on rate-limit 403s during build 🐛
Parallel multi-platform builds (amd64 + arm64) fire ~14 unauthenticated GitHub API calls concurrently — well over the 60 req/hr limit — causing 05-custom.sh to fail with a 403 on dominikh/go-tools (staticcheck). Fix: _gh_latest now retries up to 3 times with a 60-second delay on failure before giving up. A GITHUB_TOKEN build arg is also wired through to the build stage ENV so callers can pass --build-arg GITHUB_TOKEN=$(gh auth token) to raise the limit to 5000 req/hr and avoid the delay. - Dockerfile: add ARG GITHUB_TOKEN="" and ENV GITHUB_TOKEN in build stage - rootfs/root/docker/setup/05-custom.sh: retry loop (3 attempts, 60s backoff) in _gh_latest Dockerfile rootfs/root/docker/setup/05-custom.sh
This commit is contained in:
@@ -52,6 +52,9 @@ FROM ${PULL_URL}:${DISTRO_VERSION} AS build
|
||||
ARG TZ
|
||||
ARG USER
|
||||
ARG LICENSE
|
||||
# Optional: pass --build-arg GITHUB_TOKEN=$(gh auth token) to raise the API rate
|
||||
# limit from 60 to 5000 req/hr — avoids 403s in parallel multi-platform builds.
|
||||
ARG GITHUB_TOKEN=""
|
||||
ARG TIMEZONE
|
||||
ARG LANGUAGE
|
||||
ARG IMAGE_NAME
|
||||
@@ -91,6 +94,7 @@ ENV GOTOOLCHAIN="auto"
|
||||
ENV GOFLAGS="-buildvcs=false"
|
||||
ENV GOTELEMETRY="off"
|
||||
ENV GOPROXY="https://proxy.golang.org,direct"
|
||||
ENV GITHUB_TOKEN="${GITHUB_TOKEN}"
|
||||
|
||||
USER ${USER}
|
||||
WORKDIR /root
|
||||
|
||||
Reference in New Issue
Block a user