1
0
mirror of https://github.com/distribution/distribution synced 2024-11-12 05:45:51 +01:00
distribution/dockerfiles/lint.Dockerfile
Milos Gajdos 6b388b1ba6
Enable Go build tags
This enables go build tags so the GCS and OSS driver support is
available in the binary distributed via the image build by Dockerfile.

This led to quite a few fixes in the GCS and OSS packages raised as
warning by golang-ci linter.

Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-06-28 11:41:22 +01:00

20 lines
598 B
Docker

# syntax=docker/dockerfile:1
ARG GO_VERSION=1.19.9
ARG ALPINE_VERSION=3.16
ARG GOLANGCI_LINT_VERSION=v1.52
ARG BUILDTAGS="include_oss,include_gcs"
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS base
RUN apk add --no-cache gcc musl-dev
WORKDIR /src
FROM base
ENV GOFLAGS="-buildvcs=false"
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
golangci-lint --build-tags "${BUILDTAGS}" run