2023-02-23 00:45:10 +08:00
|
|
|
# syntax=docker/dockerfile:1
|
2019-03-23 04:29:28 +08:00
|
|
|
|
2024-02-28 20:18:42 +08:00
|
|
|
ARG GO_VERSION=1.21
|
2023-12-15 05:26:38 +08:00
|
|
|
ARG XX_VERSION=1.3.0
|
2023-10-19 18:24:07 +08:00
|
|
|
ARG GOLANGCI_LINT_VERSION=1.54.2
|
2021-09-03 05:11:05 +08:00
|
|
|
|
2023-12-15 05:26:38 +08:00
|
|
|
FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
|
|
|
|
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine
|
2022-04-01 17:16:04 +08:00
|
|
|
RUN apk add --no-cache git gcc musl-dev
|
2023-10-19 18:24:07 +08:00
|
|
|
ENV GOFLAGS="-buildvcs=false"
|
|
|
|
ARG GOLANGCI_LINT_VERSION
|
|
|
|
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v${GOLANGCI_LINT_VERSION}
|
2023-12-15 05:26:38 +08:00
|
|
|
COPY --link --from=xx / /
|
2019-04-25 10:29:56 +08:00
|
|
|
WORKDIR /go/src/github.com/docker/buildx
|
2023-12-15 05:26:38 +08:00
|
|
|
ARG TARGETPLATFORM
|
2023-10-19 18:24:07 +08:00
|
|
|
RUN --mount=target=/go/src/github.com/docker/buildx \
|
2023-12-15 05:26:38 +08:00
|
|
|
--mount=target=/root/.cache,type=cache,id=lint-cache-$TARGETPLATFORM \
|
|
|
|
xx-go --wrap && \
|
2023-10-19 18:24:07 +08:00
|
|
|
golangci-lint run
|