DockerCLI/dockerfiles/Dockerfile.lint

24 lines
756 B
Docker

# syntax=docker/dockerfile:1.1.3-experimental
ARG GO_VERSION=1.13.9
ARG GOLANGCI_LINTER_SHA="v1.21.0"
FROM golang:${GO_VERSION}-alpine AS build
ENV CGO_ENABLED=0
RUN apk add --no-cache git
ARG GOLANGCI_LINTER_SHA
ARG GO111MODULE=on
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
go get github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINTER_SHA}
FROM golang:${GO_VERSION}-alpine AS lint
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 . .