1
0
mirror of https://github.com/distribution/distribution synced 2024-11-12 05:45:51 +01:00
distribution/dockerfiles/git.Dockerfile
Milos Gajdos f3ba0acd24
update: bump Go runtime to 1.21.5 and the rest to latest 1.20
Signed-off-by: Milos Gajdos <milosthegajdos@gmail.com>
2023-12-06 10:32:40 +00:00

24 lines
849 B
Docker

# syntax=docker/dockerfile:1
ARG GO_VERSION=1.20.12
ARG ALPINE_VERSION=3.18
FROM alpine:${ALPINE_VERSION} AS base
RUN apk add --no-cache git gpg
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS gitvalidation
ARG GIT_VALIDATION_VERSION=v1.1.0
RUN --mount=type=cache,target=/root/.cache \
--mount=type=cache,target=/go/pkg/mod \
GOBIN=/out go install "github.com/vbatts/git-validation@${GIT_VALIDATION_VERSION}"
FROM base AS validate
ARG COMMIT_RANGE
RUN if [ -z "$COMMIT_RANGE" ]; then echo "COMMIT_RANGE required" && exit 1; fi
ENV GIT_CHECK_EXCLUDE="./vendor"
WORKDIR /src
RUN --mount=type=bind,target=. \
--mount=type=cache,target=/root/.cache \
--mount=from=gitvalidation,source=/out/git-validation,target=/usr/bin/git-validation \
git-validation -q -range "${COMMIT_RANGE}" -run short-subject,dangling-whitespace