generate OCI image labels with docker/metadata-action instead of hardcoding them in Dockerfiles

This commit is contained in:
Athou
2026-11-08 13:07:30 +01:00
parent 0be041c906
commit 103ba252f8
3 changed files with 12 additions and 2 deletions

View File

@@ -147,6 +147,12 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker metadata
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
with:
images: athou/commafeed
## build but don't push for PRs and renovate ## build but don't push for PRs and renovate
- name: Docker build - native - name: Docker build - native
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
@@ -155,6 +161,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.native file: commafeed-server/src/main/docker/Dockerfile.native
push: false push: false
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
- name: Docker build - jvm - name: Docker build - jvm
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
@@ -163,6 +170,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.jvm file: commafeed-server/src/main/docker/Dockerfile.jvm
push: false push: false
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
## build and push tag ## build and push tag
- name: Docker build and push tag - native - name: Docker build and push tag - native
@@ -173,6 +181,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.native file: commafeed-server/src/main/docker/Dockerfile.native
push: ${{ env.DOCKERHUB_USERNAME != '' }} push: ${{ env.DOCKERHUB_USERNAME != '' }}
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
tags: | tags: |
athou/commafeed:latest-${{ matrix.database }} athou/commafeed:latest-${{ matrix.database }}
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }} athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}
@@ -185,6 +194,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.jvm file: commafeed-server/src/main/docker/Dockerfile.jvm
push: ${{ env.DOCKERHUB_USERNAME != '' }} push: ${{ env.DOCKERHUB_USERNAME != '' }}
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
tags: | tags: |
athou/commafeed:latest-${{ matrix.database }}-jvm athou/commafeed:latest-${{ matrix.database }}-jvm
athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}-jvm athou/commafeed:${{ github.ref_name }}-${{ matrix.database }}-jvm
@@ -198,6 +208,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.native file: commafeed-server/src/main/docker/Dockerfile.native
push: ${{ env.DOCKERHUB_USERNAME != '' }} push: ${{ env.DOCKERHUB_USERNAME != '' }}
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
tags: athou/commafeed:master-${{ matrix.database }} tags: athou/commafeed:master-${{ matrix.database }}
- name: Docker build and push master - jvm - name: Docker build and push master - jvm
@@ -208,6 +219,7 @@ jobs:
file: commafeed-server/src/main/docker/Dockerfile.jvm file: commafeed-server/src/main/docker/Dockerfile.jvm
push: ${{ env.DOCKERHUB_USERNAME != '' }} push: ${{ env.DOCKERHUB_USERNAME != '' }}
platforms: linux/amd64,linux/arm64/v8 platforms: linux/amd64,linux/arm64/v8
labels: ${{ steps.meta.outputs.labels }}
tags: athou/commafeed:master-${{ matrix.database }}-jvm tags: athou/commafeed:master-${{ matrix.database }}-jvm
release: release:

View File

@@ -1,5 +1,4 @@
FROM ibm-semeru-runtimes:open-jdk-25.0.5.0-jre@sha256:b8fec7a8d2b3a8d50a4f070f169cf852f83208317036c38b86474d80eaf7becf FROM ibm-semeru-runtimes:open-jdk-25.0.5.0-jre@sha256:b8fec7a8d2b3a8d50a4f070f169cf852f83208317036c38b86474d80eaf7becf
LABEL org.opencontainers.image.source="https://github.com/Athou/commafeed"
EXPOSE 8082 EXPOSE 8082

View File

@@ -1,5 +1,4 @@
FROM debian:13.7@sha256:9c6e381421d0f48d1b8133e573f33c185ee16cbf505eda9c4a8a4791b25ea8a6 FROM debian:13.7@sha256:9c6e381421d0f48d1b8133e573f33c185ee16cbf505eda9c4a8a4791b25ea8a6
LABEL org.opencontainers.image.source="https://github.com/Athou/commafeed"
ARG TARGETARCH ARG TARGETARCH