[PATCH v2 12/13] container-image-multiarch: add helper recipe

Tim Orling <[email protected]> Mon, 6 Jul 2026 10:12:47 -0700
Newsgroups org.yoctoproject.lists.meta-virtualization
Message-ID <a869ef29878d35ab40b4555214e055d8983d66c3.1783356922.git.tim.orling@konsulko.com>
Similar to core-image-ptest.bb, this recipe uses mcextend to add
multiarch support for any recipe in CONTAINER_IMAGES variable.

Signed-off-by: Tim Orling <[email protected]>
---
 .../images/container-image-multiarch.bb       | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 recipes-containers/images/container-image-multiarch.bb

diff --git a/recipes-containers/images/container-image-multiarch.bb b/recipes-containers/images/container-image-multiarch.bb
new file mode 100644
index 00000000..13c4ae24
--- /dev/null
+++ b/recipes-containers/images/container-image-multiarch.bb
@@ -0,0 +1,31 @@
+inherit features_check
+REQUIRED_DISTRO_FEATURES = "vcontainer"
+
+
+DESCRIPTION += "Enable building the ${MCNAME} multiarch image."
+SUMMARY ?= "${MCNAME} multiarch image."
+HOMEPAGE ?= "https://www.yoctoproject.org/"
+LICENSE ?= "MIT"
+LIC_FILES_CHKSUM ?= "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+
+CONTAINER_IMAGES ?= "\
+    container-base \
+    app-container-curl \
+    app-container-mosquitto \
+    app-container-nginx \
+    app-container-python \
+    app-container-valkey \
+"
+
+inherit oci-multiarch
+
+BBCLASSEXTEND = "${@' '.join(['mcextend:'+x for x in d.getVar('CONTAINER_IMAGES').split()])}"
+
+OCI_MULTIARCH_RECIPE = "${MCNAME}"
+OCI_MULTIARCH_PLATFORMS = "aarch64 x86_64"
+
+python () {
+    if not d.getVar("MCNAME"):
+        raise bb.parse.SkipRecipe("No class extension set")
+}
-- 
2.54.0