From e60944eb83d7f71b8ed10aa24a65441935dc35ac Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Wed, 9 Aug 2023 19:58:01 +0200 Subject: [PATCH] Fix org.opencontainers.image.revision Docker image metadata Signed-off-by: Joachim Wiberg --- .github/workflows/docker.yml | 2 +- .github/workflows/ghcr.yml | 6 ++++-- Dockerfile | 8 +++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bd55f270..b1d72379 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -10,7 +10,6 @@ jobs: runs-on: ubuntu-latest env: MAKEFLAGS: -j3 - SOURCE_COMMIT: ${GITHUB_SHA} steps: - uses: actions/checkout@v3 - uses: docker/setup-qemu-action@v2 @@ -30,6 +29,7 @@ jobs: fi - uses: docker/build-push-action@v4 with: + build-args: revision="${GITHUB_SHA}" push: true tags: ${{ steps.vars.outputs.tags }} platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64,linux/ppc64le diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml index b57eaf3f..4e51bead 100644 --- a/.github/workflows/ghcr.yml +++ b/.github/workflows/ghcr.yml @@ -16,11 +16,12 @@ jobs: env: MAKEFLAGS: -j3 IMAGE_NAME: inadyn - SOURCE_COMMIT: ${GITHUB_SHA} + REVISION: ${GITHUB_SHA} steps: - uses: actions/checkout@v3 - name: Build image - run: docker buildx build . --file Dockerfile --tag $IMAGE_NAME --label "runnumber=${GITHUB_RUN_ID}" + run: | + docker buildx build . --build-arg "revision=$REVISION" --tag $IMAGE_NAME - name: Log in to registry run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - name: Push image @@ -37,6 +38,7 @@ jobs: fi echo IMAGE_ID=$IMAGE_ID echo VERSION=$VERSION + echo REVISION=$REVISION for ver in $VERSION; do docker tag $IMAGE_NAME $IMAGE_ID:$ver docker push $IMAGE_ID:$ver diff --git a/Dockerfile b/Dockerfile index 8a5cba8d..0ef56d04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,23 +7,25 @@ RUN apk --update --no-cache add --virtual .build-dependencies \ automake \ confuse-dev \ gcc \ + git \ gnutls-dev \ libc-dev \ libtool \ make +RUN git clean -fdx RUN ./autogen.sh RUN ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var RUN make install FROM alpine:latest -ARG SOURCE_COMMIT +ARG revision=$revision LABEL org.opencontainers.image.title="In-a-Dyn" LABEL org.opencontainers.image.description="A dynamic DNS (DDNS) client with multiple SSL/TLS library support" LABEL org.opencontainers.image.url="https://github.com/troglobit/inadyn" LABEL org.opencontainers.image.licenses="GPL-2.0" -LABEL org.opencontainers.image.revision=$SOURCE_COMMIT -LABEL org.opencontainers.image.source="https://github.com/troglobit/inadyn/tree/${SOURCE_COMMIT:-master}/" +LABEL org.opencontainers.image.revision="$revision" +LABEL org.opencontainers.image.source="https://github.com/troglobit/inadyn/tree/${revision:-master}/" RUN apk --update --no-cache add \ ca-certificates \