[meta-virtualization][PATCH 7/7] app-container-curl: use multilayer mode; container-nonroot-user
Tim Orling <[email protected]> Fri, 29 May 2026 18:31:08 -0700
| Newsgroups | org.yoctoproject.lists.meta-virtualization |
|---|---|
| Message-ID | <f3106949b40e31f8a993419a0fd8c463ed7a642c.1780104071.git.tim.orling@konsulko.com> |
* Move to recipes-containers/images to show maintenance intent * Switch to multilayer mode to more like the other "library"/"official" container recipes. * Change OCI_IMAGE_TAG to "latest" for similar reasons. * Change OCI_IMAGE_ENTRYPOINT_ARGS to "--help" to be more like upstream containers. * Install ca-certificates to enable handling https:// sites * Inherit container-nonroot-user to run as 'nonroot' with UID 65532 by default. Set PACKAGECONFIG:pn-app-container-curl = "dev" in local.conf or distro/image config to run as `root` and include a CONTAINER_SHELL. Signed-off-by: Tim Orling <[email protected]> --- .../images/app-container-curl.bb | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) rename {recipes-demo => recipes-containers}/images/app-container-curl.bb (58%) diff --git a/recipes-demo/images/app-container-curl.bb b/recipes-containers/images/app-container-curl.bb similarity index 58% rename from recipes-demo/images/app-container-curl.bb rename to recipes-containers/images/app-container-curl.bb index ddeb3022..34204fb9 100644 --- a/recipes-demo/images/app-container-curl.bb +++ b/recipes-containers/images/app-container-curl.bb @@ -2,9 +2,31 @@ SUMMARY = "Curl Application container image" LICENSE = "MIT" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +# Multi-layer mode: create explicit layers instead of single rootfs layer +OCI_LAYER_MODE = "multi" + +# Optional 'dev' mode: +# - runs the container as root (UID 0) +# Enable with: PACKAGECONFIG:pn-app-container-curl = "dev" +PACKAGECONFIG ??= "" +PACKAGECONFIG[dev] = "" + +# Define layers: each layer contains specific packages +# Format: "name:type:content" where content uses + as delimiter for multiple items +OCI_LAYERS = "\ + base:packages:base-files+base-passwd+netbase \ + ${@bb.utils.contains('PACKAGECONFIG', 'dev', 'shell:packages:${CONTAINER_SHELL}', '', d)} \ + curl:packages:curl+ca-certificates \ +" + +# In 'dev' mode, override the nonroot UID inherited from container-nonroot-user +# so the container runs as root. +OCI_IMAGE_RUNTIME_UID = "${@bb.utils.contains('PACKAGECONFIG', 'dev', '0', '${NONROOT_UID}', d)}" + IMAGE_FSTYPES = "container oci" inherit image inherit image-oci +inherit container-nonroot-user IMAGE_FEATURES = "" IMAGE_LINGUAS = "" @@ -39,8 +61,7 @@ rootfs_fixup_var_volatile () { } OCI_IMAGE_ENTRYPOINT = "curl" -OCI_IMAGE_TAG = "easy" -OCI_IMAGE_ENTRYPOINT_ARGS = "http://localhost:80" -CONTAINER_SHELL = "busybox" +OCI_IMAGE_TAG = "latest" +OCI_IMAGE_ENTRYPOINT_ARGS = "--help" -IMAGE_INSTALL:append = " curl" +IMAGE_INSTALL:append = " curl ca-certificates" -- 2.54.0