From 0e17e5409133bf70576844a1031e579ff3634d82 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Wed, 20 Jul 2022 16:44:31 +0200 Subject: [PATCH] dockerfiles: formatting Signed-off-by: CrazyMax --- Dockerfile | 24 +++++++++---------- dockerfiles/git.Dockerfile | 10 ++++---- dockerfiles/lint.Dockerfile | 6 ++--- dockerfiles/vendor.Dockerfile | 44 +++++++++++++++++------------------ 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/Dockerfile b/Dockerfile index 72ed20e6..d99d8288 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,11 +24,11 @@ ARG TARGETPLATFORM ARG LDFLAGS="-s -w" ARG BUILDTAGS="include_oss include_gcs" RUN --mount=type=bind,target=/src,rw \ - --mount=type=cache,target=/root/.cache/go-build \ - --mount=target=/go/pkg/mod,type=cache \ - --mount=type=bind,source=/tmp/.ldflags,target=/tmp/.ldflags,from=version \ - set -x ; xx-go build -trimpath -ldflags "$(cat /tmp/.ldflags) ${LDFLAGS}" -o /usr/bin/registry ./cmd/registry \ - && xx-verify --static /usr/bin/registry + --mount=type=cache,target=/root/.cache/go-build \ + --mount=target=/go/pkg/mod,type=cache \ + --mount=type=bind,source=/tmp/.ldflags,target=/tmp/.ldflags,from=version \ + set -x ; xx-go build -trimpath -ldflags "$(cat /tmp/.ldflags) ${LDFLAGS}" -o /usr/bin/registry ./cmd/registry \ + && xx-verify --static /usr/bin/registry FROM scratch AS binary COPY --from=build /usr/bin/registry / @@ -39,13 +39,13 @@ ARG TARGETARCH ARG TARGETVARIANT WORKDIR /work RUN --mount=from=binary,target=/build \ - --mount=type=bind,target=/src \ - --mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \ - VERSION=$(cat /tmp/.version) \ - && mkdir -p /out \ - && cp /build/registry /src/README.md /src/LICENSE . \ - && tar -czvf "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz" * \ - && sha256sum -z "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz" | awk '{ print $1 }' > "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz.sha256" + --mount=type=bind,target=/src \ + --mount=type=bind,source=/tmp/.version,target=/tmp/.version,from=version \ + VERSION=$(cat /tmp/.version) \ + && mkdir -p /out \ + && cp /build/registry /src/README.md /src/LICENSE . \ + && tar -czvf "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz" * \ + && sha256sum -z "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz" | awk '{ print $1 }' > "/out/registry_${VERSION#v}_${TARGETOS}_${TARGETARCH}${TARGETVARIANT}.tar.tgz.sha256" FROM scratch AS artifact COPY --from=releaser /out / diff --git a/dockerfiles/git.Dockerfile b/dockerfiles/git.Dockerfile index 1d217eff..38effe42 100644 --- a/dockerfiles/git.Dockerfile +++ b/dockerfiles/git.Dockerfile @@ -9,8 +9,8 @@ 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}" + --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 @@ -18,6 +18,6 @@ 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 + --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 diff --git a/dockerfiles/lint.Dockerfile b/dockerfiles/lint.Dockerfile index 51052fa9..113db75a 100644 --- a/dockerfiles/lint.Dockerfile +++ b/dockerfiles/lint.Dockerfile @@ -13,6 +13,6 @@ 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 run + --mount=type=cache,target=/root/.cache \ + --mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \ + golangci-lint run diff --git a/dockerfiles/vendor.Dockerfile b/dockerfiles/vendor.Dockerfile index 42cce5ec..b56e5ee9 100644 --- a/dockerfiles/vendor.Dockerfile +++ b/dockerfiles/vendor.Dockerfile @@ -10,14 +10,14 @@ WORKDIR /src FROM base AS vendored RUN --mount=target=/context \ - --mount=target=.,type=tmpfs \ - --mount=target=/go/pkg/mod,type=cache <&2 'ERROR: Vendor result differs. Please vendor your package with "make vendor"' - git status --porcelain -- go.mod go.sum vendor - exit 1 -fi + --mount=target=.,type=tmpfs <&2 'ERROR: Vendor result differs. Please vendor your package with "make vendor"' + git status --porcelain -- go.mod go.sum vendor + exit 1 + fi EOT FROM psampaz/go-mod-outdated:${MODOUTDATED_VERSION} AS go-mod-outdated FROM base AS outdated ARG _RANDOM RUN --mount=target=.,ro \ - --mount=target=/go/pkg/mod,type=cache \ - --mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \ - go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct + --mount=target=/go/pkg/mod,type=cache \ + --mount=from=go-mod-outdated,source=/home/go-mod-outdated,target=/usr/bin/go-mod-outdated \ + go list -mod=readonly -u -m -json all | go-mod-outdated -update -direct