containers: introduce image-oci
containers: introduce image-oci

This image class creates an oci image spec directory from a generated
rootfs. The contents of the rootfs do not matter (i.e. they need not be
container optimized), but by using the container image type and small
footprint images, we can create directly executable container images.

Once the tarball (or oci image directory) has been created of the OCI
image, it can be manipulated by standard tools. For example, to create a
runtime bundle from the oci image, the following can be done:

Assuming the image name is "container-base":

  If the oci image was a tarball, extract it (skip, if a directory is being directly used)
    % tar xvf container-base-<arch>-<stamp>.rootfs-oci-latest-x86_64-linux.oci-image.tar

  And then create the bundle:
    % oci-image-tool create --ref name=latest container-base-<arch>-<stamp>.rootfs-oci container-base-oci-bundle

  Or to copy (push) the oci image to a docker registry, skopeo can be used (vary the
  tag based on the created oci image:

    % skopeo copy --dest-creds <username>:<password> oci:container-base-<arch>-<stamp>:latest docker://zeddii/container-base

The following image variables are available to customize the details
of the constructed image (defaults as shown):

   OCI_IMAGE_AUTHOR ?= "${PATCH_GIT_USER_NAME}"
   OCI_IMAGE_AUTHOR_EMAIL ?= "${PATCH_GIT_USER_EMAIL}"

   OCI_IMAGE_TAG ?= "latest"
   OCI_IMAGE_RUNTIME_UID ?= ""

   OCI_IMAGE_ARCH ?= "${TARGET_ARCH}"
   OCI_IMAGE_SUBARCH ?= "${@oci_map_subarch(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}"

   OCI_IMAGE_ENTRYPOINT ?= "sh"
   OCI_IMAGE_ENTRYPOINT_ARGS ?= ""
   OCI_IMAGE_WORKINGDIR ?= ""

   //List of ports to expose from a container running this image:
   //PORT[/PROT]
   //  format: <port>/tcp, <port>/udp, or <port> (same as <port>/tcp).
   OICI_IMAGE_PORTS ?= ""

   // key=value list of labels
   OCI_IMAGE_LABELS ?= ""
   // key=value list of environment variables
   OCI_IMAGE_ENV_VARS ?= ""

Signed-off-by: Bruce Ashfield <284cc737d174a260eec2a2a6324a304f84b1ae0f@gmail.com>

lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization,lgirdk/meta-virtualization