diff --git a/Dockerfile b/Dockerfile index 78bd902..ebc1269 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,8 +60,8 @@ RUN --mount=type=bind,target=. \ FROM gobase AS version ARG PKG RUN --mount=target=. \ - VERSION=$(git describe --match 'v[0-9]*' --dirty='.m' --always --tags); \ - echo "-s -w -X ${PKG}/credentials.Version=${VERSION}" | tee /tmp/.ldflags; \ + 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 "-s -w -X ${PKG}/credentials.Version=${VERSION} -X ${PKG}/credentials.Revision=${REVISION} -X ${PKG}/credentials.Package=${PKG}" | tee /tmp/.ldflags; \ echo -n "${VERSION}" | tee /tmp/.version; FROM gobase AS base @@ -93,6 +93,7 @@ FROM scratch AS test-coverage COPY --from=test /out / FROM base AS build-linux +ARG PKG ARG TARGETOS ARG TARGETARCH ARG TARGETVARIANT @@ -102,13 +103,14 @@ RUN --mount=type=bind,target=. \ --mount=type=bind,from=version,source=/tmp/.ldflags,target=/tmp/.ldflags <