diff --git a/.gitea/workflows/build-images.yaml b/.gitea/workflows/build-images.yaml index 0e7afe8..25cbc91 100644 --- a/.gitea/workflows/build-images.yaml +++ b/.gitea/workflows/build-images.yaml @@ -31,6 +31,12 @@ jobs: context: postgres base_image: postgres:18 primary_tag: git.ajpanton.se/ajp_anton/postgres-custom:18 + oci_labels: | + org.opencontainers.image.title=PostgreSQL 18 with extensions + org.opencontainers.image.description=PostgreSQL 18 with PostGIS, pgvector, pg_cron, and VectorChord preloaded. + org.opencontainers.image.documentation=https://git.ajpanton.se/ajp_anton/docker-images#postgres-custom + org.opencontainers.image.source=https://git.ajpanton.se/ajp_anton/docker-images + org.opencontainers.image.url=https://git.ajpanton.se/ajp_anton/-/packages/container/postgres-custom tags: | git.ajpanton.se/ajp_anton/postgres-custom:18 git.ajpanton.se/ajp_anton/postgres-custom:18-postgis3-vchord0.5.3 @@ -45,6 +51,12 @@ jobs: context: php8-pgsql base_image: php:8-fpm-alpine primary_tag: git.ajpanton.se/ajp_anton/php8-pgsql:8 + oci_labels: | + org.opencontainers.image.title=PHP 8 FPM with PostgreSQL support + org.opencontainers.image.description=PHP 8 FPM on Alpine with libpq and the pdo_pgsql extension enabled. + org.opencontainers.image.documentation=https://git.ajpanton.se/ajp_anton/docker-images#php8-pgsql + org.opencontainers.image.source=https://git.ajpanton.se/ajp_anton/docker-images + org.opencontainers.image.url=https://git.ajpanton.se/ajp_anton/-/packages/container/php8-pgsql tags: | git.ajpanton.se/ajp_anton/php8-pgsql:8 git.ajpanton.se/ajp_anton/php8-pgsql:8-fpm-alpine @@ -57,6 +69,12 @@ jobs: context: python-tools base_image: python:3 primary_tag: git.ajpanton.se/ajp_anton/python-tools:3 + oci_labels: | + org.opencontainers.image.title=Python 3 tools with ExifTool + org.opencontainers.image.description=Python 3 utility image with ExifTool for local helper workflows. + org.opencontainers.image.documentation=https://git.ajpanton.se/ajp_anton/docker-images#python-tools + org.opencontainers.image.source=https://git.ajpanton.se/ajp_anton/docker-images + org.opencontainers.image.url=https://git.ajpanton.se/ajp_anton/-/packages/container/python-tools tags: | git.ajpanton.se/ajp_anton/python-tools:3 git.ajpanton.se/ajp_anton/python-tools:latest @@ -83,6 +101,7 @@ jobs: BASE_IMAGE: ${{ matrix.image.base_image }} PRIMARY_TAG: ${{ matrix.image.primary_tag }} TAGS: ${{ matrix.image.tags }} + OCI_LABELS: ${{ matrix.image.oci_labels }} BUILD_ARGS: ${{ matrix.image.build_args }} FINGERPRINT_COMMAND: ${{ matrix.image.fingerprint_command }} run: ./scripts/build-image-if-changed.sh diff --git a/scripts/build-image-if-changed.sh b/scripts/build-image-if-changed.sh index 7a58a54..5f52652 100755 --- a/scripts/build-image-if-changed.sh +++ b/scripts/build-image-if-changed.sh @@ -6,6 +6,7 @@ set -euo pipefail : "${BASE_IMAGE:?}" : "${PRIMARY_TAG:?}" : "${TAGS:?}" +: "${OCI_LABELS:?}" : "${BUILD_ARGS:?}" : "${FINGERPRINT_COMMAND:?}" @@ -17,10 +18,14 @@ cleanup() { trap cleanup EXIT mapfile -t build_args < <(printf '%s\n' "$BUILD_ARGS" | sed '/^[[:space:]]*$/d') +mapfile -t oci_labels < <(printf '%s\n' "$OCI_LABELS" | sed '/^[[:space:]]*$/d') build_flags=(--pull --no-cache --load --tag "$candidate_tag") for build_arg in "${build_args[@]}"; do build_flags+=(--build-arg "$build_arg") done +for oci_label in "${oci_labels[@]}"; do + build_flags+=(--label "$oci_label") +done context_hash="$( cd "$BUILD_CONTEXT" @@ -37,6 +42,7 @@ fingerprint() { printf 'base-image-id=%s\n' "$base_image_id" printf 'context-hash=%s\n' "$context_hash" printf 'build-args=%s\n' "$BUILD_ARGS" + printf 'oci-labels=%s\n' "$OCI_LABELS" docker run --rm --entrypoint /bin/sh "$1" -c "$FINGERPRINT_COMMAND" } | sha256sum | awk '{print $1}' }