Dockerfile: retry go install up to 5x with backoff — DNS to 192.168.0.1:53 flakes intermittently for proxy.golang.org

This commit is contained in:
Kayos 2026-04-29 18:41:59 +00:00
parent 6cd599079b
commit a1b3c72c8f

View file

@ -237,8 +237,12 @@ ENV PATH=/home/crafter/go/bin:/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.li
# 17. Go user tooling: govulncheck + staticcheck # 17. Go user tooling: govulncheck + staticcheck
# ============================================================ # ============================================================
RUN go install golang.org/x/vuln/cmd/govulncheck@latest \ RUN for i in 1 2 3 4 5; do \
&& go install honnef.co/go/tools/cmd/staticcheck@latest go install golang.org/x/vuln/cmd/govulncheck@latest \
&& go install honnef.co/go/tools/cmd/staticcheck@latest \
&& break || { echo "go install attempt $i failed, sleeping $((i*10))s"; sleep $((i*10)); }; \
done; \
command -v govulncheck && command -v staticcheck || { echo "go install failed after 5 attempts"; exit 1; }
# Make GOPATH bin discoverable for the crafter user # Make GOPATH bin discoverable for the crafter user
ENV PATH=/home/crafter/go/bin:$PATH \ ENV PATH=/home/crafter/go/bin:$PATH \