From 23b217af2498fc5d14d6b49243f3b9c5081e1f8b Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 29 Nov 2022 12:54:15 +0100 Subject: [PATCH] hack: mutualize build opts in Makefile and Dockerfile Signed-off-by: CrazyMax --- Dockerfile | 31 +++++++++++++++++++------------ Makefile | 29 +++++++++++++++++++++++++---- hack/build | 16 ++++++++++++++++ hack/git-meta | 16 ++++++++++++++++ 4 files changed, 76 insertions(+), 16 deletions(-) create mode 100755 hack/build create mode 100755 hack/git-meta diff --git a/Dockerfile b/Dockerfile index a1556c69..ebf05c31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,20 +19,24 @@ ENV CGO_ENABLED=0 WORKDIR /src FROM gobase AS buildx-version -RUN --mount=target=. \ - PKG=github.com/docker/buildx VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags) REVISION=$(git rev-parse HEAD)$(if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi); \ - echo "-X ${PKG}/version.Version=${VERSION} -X ${PKG}/version.Revision=${REVISION} -X ${PKG}/version.Package=${PKG}" | tee /tmp/.ldflags; \ - echo -n "${VERSION}" | tee /tmp/.version; +RUN --mount=type=bind,target=. <" + exit 1 + ;; +esac