2022-07-20 12:18:18 +00:00
|
|
|
# syntax=docker/dockerfile:1
|
|
|
|
|
2023-05-09 10:22:22 +00:00
|
|
|
ARG GO_VERSION=1.19.9
|
2022-07-20 12:18:18 +00:00
|
|
|
ARG ALPINE_VERSION=3.16
|
|
|
|
|
|
|
|
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 \
|
2022-07-20 14:44:31 +00:00
|
|
|
--mount=type=cache,target=/go/pkg/mod \
|
|
|
|
GOBIN=/out go install "github.com/vbatts/git-validation@${GIT_VALIDATION_VERSION}"
|
2022-07-20 12:18:18 +00:00
|
|
|
|
|
|
|
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=. \
|
2022-07-20 14:44:31 +00:00
|
|
|
--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
|