From 989d35d7485647db8173ff1c2dc670f015418388 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Tue, 16 Apr 2024 11:10:34 +0200 Subject: [PATCH] feat(release): add OCI labels to container images (cherry picked from commit 028d19c0fedf5d499ae1b32b2f0bcb417b6e9303) --- .forgejo/workflows/build-release.yml | 6 ++++-- Dockerfile | 11 ++++++++++- Dockerfile.rootless | 11 ++++++++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index 3a247fc4d8..4a46ff31a2 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -159,7 +159,7 @@ jobs: - name: build container & release if: ${{ secrets.TOKEN != '' }} - uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v5 + uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v5.1 with: forgejo: "${{ env.GITHUB_SERVER_URL }}" owner: "${{ env.GITHUB_REPOSITORY_OWNER }}" @@ -173,11 +173,12 @@ jobs: binary-name: forgejo binary-path: /app/gitea/gitea override: "${{ steps.release-info.outputs.override }}" + verify-labels: "maintainer=contact@forgejo.org,org.opencontainers.image.version=${{ steps.release-info.outputs.version }}" verbose: ${{ vars.VERBOSE || secrets.VERBOSE || 'false' }} - name: build rootless container if: ${{ secrets.TOKEN != '' }} - uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v5 + uses: https://code.forgejo.org/forgejo/forgejo-build-publish/build@v5.1 with: forgejo: "${{ env.GITHUB_SERVER_URL }}" owner: "${{ env.GITHUB_REPOSITORY_OWNER }}" @@ -190,6 +191,7 @@ jobs: suffix: -rootless dockerfile: Dockerfile.rootless override: "${{ steps.release-info.outputs.override }}" + verify-labels: "maintainer=contact@forgejo.org,org.opencontainers.image.version=${{ steps.release-info.outputs.version }}" verbose: ${{ vars.VERBOSE || secrets.VERBOSE || 'false' }} - name: end-to-end tests diff --git a/Dockerfile b/Dockerfile index dcd6b0eba6..475164481a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -52,7 +52,16 @@ RUN chmod 755 /tmp/local/usr/bin/entrypoint \ RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete FROM docker.io/library/alpine:3.19 -LABEL maintainer="contact@forgejo.org" +LABEL maintainer="contact@forgejo.org" \ + org.opencontainers.image.authors="Forgejo" \ + org.opencontainers.image.url="https://forgejo.org" \ + org.opencontainers.image.documentation="https://forgejo.org/download/#container-image" \ + org.opencontainers.image.source="https://codeberg.org/forgejo/forgejo" \ + org.opencontainers.image.version="${RELEASE_VERSION}" \ + org.opencontainers.image.vendor="Forgejo" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="Forgejo. Beyond coding. We forge." \ + org.opencontainers.image.description="Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job." EXPOSE 22 3000 diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 33b7c3c3e0..3f4cba955a 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -50,7 +50,16 @@ RUN chmod 755 /tmp/local/usr/local/bin/docker-entrypoint.sh \ RUN chmod 644 /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_autocomplete FROM docker.io/library/alpine:3.19 -LABEL maintainer="contact@forgejo.org" +LABEL maintainer="contact@forgejo.org" \ + org.opencontainers.image.authors="Forgejo" \ + org.opencontainers.image.url="https://forgejo.org" \ + org.opencontainers.image.documentation="https://forgejo.org/download/#container-image" \ + org.opencontainers.image.source="https://codeberg.org/forgejo/forgejo" \ + org.opencontainers.image.version="${RELEASE_VERSION}" \ + org.opencontainers.image.vendor="Forgejo" \ + org.opencontainers.image.licenses="MIT" \ + org.opencontainers.image.title="Forgejo. Beyond coding. We forge." \ + org.opencontainers.image.description="Forgejo is a self-hosted lightweight software forge. Easy to install and low maintenance, it just does the job." EXPOSE 2222 3000