# syntax=docker/dockerfile:1 ARG GO_VERSION=1.19.12 ARG ALPINE_VERSION=3.17 ARG GOLANGCI_LINT_VERSION=v1.49.0 FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS build ENV CGO_ENABLED=0 RUN apk add --no-cache git ARG GOLANGCI_LINT_VERSION ARG GO111MODULE=on RUN --mount=type=cache,target=/root/.cache/go-build \ --mount=type=cache,target=/go/pkg/mod \ go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS lint ENV GO111MODULE=off ENV CGO_ENABLED=0 ENV DISABLE_WARN_OUTSIDE_CONTAINER=1 COPY --from=build /go/bin/golangci-lint /usr/local/bin WORKDIR /go/src/github.com/docker/cli ENV GOGC=75 ENTRYPOINT ["/usr/local/bin/golangci-lint"] CMD ["run", "--config=.golangci.yml"] COPY . .