From 5a54967d0ce41f446ef728080b143ff9d0de1801 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Wed, 23 Apr 2025 15:51:41 +0000
Subject: [PATCH] feat: populate OCI labels

---
 containers/debian/Dockerfile | 13 ++++--
 containers/eic/Dockerfile    | 83 ++++++++++++++++++++++++++++++++++++
 2 files changed, 92 insertions(+), 4 deletions(-)

diff --git a/containers/debian/Dockerfile b/containers/debian/Dockerfile
index c8423d699..b6cc9caeb 100644
--- a/containers/debian/Dockerfile
+++ b/containers/debian/Dockerfile
@@ -4,12 +4,17 @@ ARG BASE_IMAGE="amd64/debian:stable-slim"
 ARG BUILD_IMAGE="debian_stable_base"
 
 # Minimal container based on Debian base systems for up-to-date packages. 
-FROM  ${BASE_IMAGE}
+FROM ${BASE_IMAGE}
 ARG TARGETPLATFORM
 
-LABEL maintainer="Sylvester Joosten <sjoosten@anl.gov>" \
-      name="${BUILD_IMAGE}" \
-      march="amd64"
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider base image ($TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
 
 COPY bashrc /root/.bashrc
 
diff --git a/containers/eic/Dockerfile b/containers/eic/Dockerfile
index 400607357..8d54eb0e7 100644
--- a/containers/eic/Dockerfile
+++ b/containers/eic/Dockerfile
@@ -37,6 +37,15 @@ ARG INTERNAL_TAG="master"
 FROM ${DOCKER_REGISTRY}${BUILDER_IMAGE}:${INTERNAL_TAG} as builder_concretization_default
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider build concretization image (default configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 ## Copy our default environment
 COPY --from=spack-environment . /opt/spack-environment/
 ARG ENV=xl
@@ -59,6 +68,15 @@ EOF
 FROM builder_concretization_default as builder_installation_default
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider build installation image (default configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 # Installation (default environment)
 RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM}              \
     --mount=type=cache,target=/var/cache/spack                          \
@@ -86,6 +104,15 @@ EOF
 FROM ${DOCKER_REGISTRY}${RUNTIME_IMAGE}:${INTERNAL_TAG} as runtime_concretization_default
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider runtime concretization image (default configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 ## Copy our default environment
 COPY --from=spack-environment . /opt/spack-environment/
 ARG ENV=xl
@@ -105,6 +132,15 @@ COPY --from=builder_installation_default \
 FROM runtime_concretization_default as runtime_installation_default
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider runtime installation image (default configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 # Installation (default environment, from buildcache)
 RUN --mount=type=cache,target=/var/cache/spack                          \
     --mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \
@@ -139,6 +175,15 @@ EOF
 FROM builder_installation_default as builder_concretization_custom
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider build concretization image (custom configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 ## 2. Setup our environment with custom versions (on top of cached layer)
 ## Note: these default versions are just the very first commit.
 ARG EDM4EIC_VERSION="8aeb507f93a93257c99985efbce0ec1371e0b331"
@@ -185,6 +230,15 @@ EOF
 FROM builder_concretization_custom as builder_installation_custom
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider build installation image (custom configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 # Installation (custom environment)
 RUN --mount=type=cache,target=/ccache,id=${TARGETPLATFORM}              \
     --mount=type=cache,target=/var/cache/spack                          \
@@ -218,6 +272,17 @@ EOF
 ## - runtime base with concretization of custom versions (taken from equivalent builder)
 ## ========================================================================================
 FROM runtime_installation_default as runtime_concretization_custom
+ARG TARGETPLATFORM
+
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider runtime concretization image (custom configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 COPY --from=builder_installation_custom \
   /opt/spack-environment/${ENV}/spack.* \
   /opt/spack-environment/${ENV}/
@@ -233,6 +298,15 @@ COPY --from=builder_installation_custom \
 FROM runtime_concretization_custom as runtime_installation_custom
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider runtime installation image (custom configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 # Installation (default environment, from buildcache)
 RUN --mount=type=cache,target=/var/cache/spack                          \
     --mount=type=secret,id=mirrors,target=/opt/spack/etc/spack/mirrors.yaml \
@@ -259,6 +333,15 @@ EOF
 FROM runtime_installation_custom
 ARG TARGETPLATFORM
 
+# Open Container Initiative labels
+LABEL org.opencontainers.image.title="Electron-Ion Collider runtime installation image (custom configuration, $TARGETPLATFORM)"
+LABEL org.opencontainers.image.vendor="Electron-Ion Collider"
+LABEL org.opencontainers.image.authors="Electron-Ion Collider Software Working Groups <eic-software-l-owner@lists.bnl.gov>"
+LABEL org.opencontainers.image.url="https://github.com/eic/containers"
+LABEL org.opencontainers.image.source="https://github.com/eic/containers"
+LABEL org.opencontainers.image.documentation="https://eic.github.io"
+LABEL org.opencontainers.image.license="GPL-3.0-or-later"
+
 ## Create views at /opt/local and /opt/detector
 RUN <<EOF
 set -e
-- 
GitLab