2020-12-06 08:24:12 +00:00
|
|
|
# syntax = docker/dockerfile:1.2
|
2021-06-01 13:51:15 +00:00
|
|
|
FROM golang:1.16-alpine AS vendored
|
2019-01-26 06:29:13 +00:00
|
|
|
RUN apk add --no-cache git
|
|
|
|
WORKDIR /src
|
|
|
|
RUN --mount=target=/src,rw \
|
|
|
|
--mount=target=/go/pkg/mod,type=cache \
|
|
|
|
go mod tidy && go mod vendor && \
|
|
|
|
mkdir /out && cp -r go.mod go.sum vendor /out
|
|
|
|
|
|
|
|
FROM scratch AS update
|
|
|
|
COPY --from=vendored /out /out
|
|
|
|
|
|
|
|
FROM vendored AS validate
|
|
|
|
RUN --mount=target=.,rw \
|
|
|
|
git add -A && \
|
|
|
|
rm -rf vendor && \
|
|
|
|
cp -rf /out/* . && \
|
|
|
|
./hack/validate-vendor check
|