fix: use pre-built golangci-lint binary instead of go install
All checks were successful
Check / check (pull_request) Successful in 13m22s
All checks were successful
Check / check (pull_request) Successful in 13m22s
go install fails in alpine Docker builder because the linker (ld) is not available. Download the official pre-built binary with SHA256 verification instead. Supports both amd64 and arm64 architectures. Fixes #126
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -4,8 +4,20 @@ FROM golang@sha256:f6751d823c26342f9506c03797d2527668d095b0a15f1862cddb4d927a7a4
|
|||||||
|
|
||||||
RUN apk add --no-cache git make gcc musl-dev
|
RUN apk add --no-cache git make gcc musl-dev
|
||||||
|
|
||||||
# Install golangci-lint v2
|
# Install golangci-lint v2 (pre-built binary — go install fails in alpine due to missing linker)
|
||||||
RUN go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@5d1e709b7be35cb2025444e19de266b056b7b7ee # v2.10.1
|
RUN set -e; \
|
||||||
|
GOLANGCI_VERSION="2.10.1"; \
|
||||||
|
case "$(uname -m)" in \
|
||||||
|
x86_64) ARCH="amd64"; SHA256="dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99" ;; \
|
||||||
|
aarch64) ARCH="arm64"; SHA256="6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8" ;; \
|
||||||
|
*) echo "unsupported arch: $(uname -m)" >&2; exit 1 ;; \
|
||||||
|
esac; \
|
||||||
|
wget -q -O /tmp/golangci-lint.tar.gz \
|
||||||
|
"https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_VERSION}/golangci-lint-${GOLANGCI_VERSION}-linux-${ARCH}.tar.gz"; \
|
||||||
|
echo "${SHA256} /tmp/golangci-lint.tar.gz" | sha256sum -c -; \
|
||||||
|
tar -xzf /tmp/golangci-lint.tar.gz -C /usr/local/bin --strip-components=1 "golangci-lint-${GOLANGCI_VERSION}-linux-${ARCH}/golangci-lint"; \
|
||||||
|
rm /tmp/golangci-lint.tar.gz; \
|
||||||
|
golangci-lint version
|
||||||
RUN go install golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0 # v0.42.0
|
RUN go install golang.org/x/tools/cmd/goimports@009367f5c17a8d4c45a961a3a509277190a9a6f0 # v0.42.0
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|||||||
Reference in New Issue
Block a user