ci: adjust build arguments (#2772)

The build arguments `VCS_REF` and `VCS_VER` were renamed and given
proper values according to their names.

1. `VCS_REVISION` holds the current SHA sum of the (git) HEAD pointer
2. `VCS_VERSION` now holds the contents of the `VERSION` file, i.e. a
   semver version tag (one can now inspect the image and find a proper
   version tag in the `org.opencontainers.image.version` label)

The build arguments were given defaults in order to allow the
`generic_build` and `generic_test` workflows to omit them (as they are
not need there anyways). When publishing images, this is fina as the
cache will rebuild almost all of the image except the last few layers
which are `LABEL`s anyways.
This commit is contained in:
Georg Lauterbach 2022-09-16 19:23:33 +02:00 committed by GitHub
parent f8e1bb0f42
commit 6113b99881
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 16 deletions

View file

@ -281,8 +281,8 @@ COPY target/scripts/helpers /usr/local/bin/helpers
#
FROM stage-base AS stage-final
ARG VCS_REF
ARG VCS_VER
ARG VCS_REVISION=unknown
ARG VCS_VERSION=edge
WORKDIR /
EXPOSE 25 587 143 465 993 110 995 4190
@ -312,5 +312,5 @@ LABEL org.opencontainers.image.documentation="https://github.com/docker-mailserv
LABEL org.opencontainers.image.source="https://github.com/docker-mailserver/docker-mailserver"
# ARG invalidates cache when it is used by a layer (implicitly affects RUN)
# Thus to maximize cache, keep these lines last:
LABEL org.opencontainers.image.revision=${VCS_REF}
LABEL org.opencontainers.image.version=${VCS_VER}
LABEL org.opencontainers.image.revision=${VCS_REVISION}
LABEL org.opencontainers.image.version=${VCS_VERSION}