fix: detect architecture for golangci-lint download in Docker build
All checks were successful
check / check (push) Successful in 1m34s
All checks were successful
check / check (push) Successful in 1m34s
The golangci-lint binary was hardcoded as linux-amd64, causing Docker builds to fail on arm64 hosts. The amd64 ELF binary cannot execute on aarch64, producing a misleading shell syntax error during make check. Use uname -m to detect the container architecture at build time and download the matching binary. Both amd64 and arm64 SHA-256 hashes are pinned. Closes #15
This commit is contained in:
16
Dockerfile
16
Dockerfile
@@ -13,10 +13,20 @@ RUN apk add --no-cache \
|
||||
curl
|
||||
|
||||
# golangci-lint v2.10.1, 2026-02-25
|
||||
RUN curl -sSfL https://github.com/golangci/golangci-lint/releases/download/v2.10.1/golangci-lint-2.10.1-linux-amd64.tar.gz -o /tmp/golangci-lint.tar.gz && \
|
||||
echo "dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99 /tmp/golangci-lint.tar.gz" | sha256sum -c - && \
|
||||
# SHA-256 checksums per architecture (amd64 / arm64)
|
||||
RUN set -e; \
|
||||
ARCH="$(uname -m)"; \
|
||||
if [ "$ARCH" = "aarch64" ] || [ "$ARCH" = "arm64" ]; then \
|
||||
GOARCH="arm64"; \
|
||||
HASH="6652b42ae02915eb2f9cb2a2e0cac99514c8eded8388d88ae3e06e1a52c00de8"; \
|
||||
else \
|
||||
GOARCH="amd64"; \
|
||||
HASH="dfa775874cf0561b404a02a8f4481fc69b28091da95aa697259820d429b09c99"; \
|
||||
fi; \
|
||||
curl -sSfL "https://github.com/golangci/golangci-lint/releases/download/v2.10.1/golangci-lint-2.10.1-linux-${GOARCH}.tar.gz" -o /tmp/golangci-lint.tar.gz && \
|
||||
echo "${HASH} /tmp/golangci-lint.tar.gz" | sha256sum -c - && \
|
||||
tar -xzf /tmp/golangci-lint.tar.gz -C /tmp && \
|
||||
mv /tmp/golangci-lint-2.10.1-linux-amd64/golangci-lint /usr/local/bin/ && \
|
||||
mv "/tmp/golangci-lint-2.10.1-linux-${GOARCH}/golangci-lint" /usr/local/bin/ && \
|
||||
rm -rf /tmp/golangci-lint*
|
||||
|
||||
WORKDIR /src
|
||||
|
||||
Reference in New Issue
Block a user