Skip to contentSkip to conversation

Add support to generate OCI images

PATCH Superseded Sergio Prado 1 participant 3 messages Oct 25, 2020 VFS

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add support to generate OCI images

From: Sergio Prado <[email protected]>

This patch set adds support to OCI images.

The OCI image format is a specification for container images defined and maintained as an open standard by the Open Container Initiative [1].

To generate the image according to the specification [2], a tool called sloci-image is used.

[1] https://opencontainers.org/
[2] https://github.com/opencontainers/image-spec/blob/master/spec.md

The generated container images were tested on x86_64, arm and aarch64.

Sergio Prado (2):
package/sloci-image: new host package
oci: add new filesystem type

 DEVELOPERS                                    |  1 +
 fs/Config.in                                  |  1 +
 fs/oci/Config.in                              | 88 +++++++++++++++++
 fs/oci/oci.mk                                 | 97 +++++++++++++++++++
 package/Config.in.host                        |  1 +
 ...ues-when-generating-the-OCI-image-co.patch | 55 +++++++++++
 package/sloci-image/Config.in.host            |  7 ++
 package/sloci-image/sloci-image.hash          |  5 +
 package/sloci-image/sloci-image.mk            | 19 ++++
 9 files changed, 274 insertions(+)
 create mode 100644 fs/oci/Config.in
 create mode 100644 fs/oci/oci.mk
 create mode 100644 package/sloci-image/0001-Fix-escaping-issues-when-generating-the-OCI-image-co.patch
 create mode 100644 package/sloci-image/Config.in.host
 create mode 100644 package/sloci-image/sloci-image.hash
 create mode 100644 package/sloci-image/sloci-image.mk
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/2 package/sloci-image: new host package

From: Sergio Prado <[email protected]>

sloci-image is a simple CLI tool for packing rootfs into a single-layer OCI image.

The patch fixes a escaping issue and a PR was sent upstream:

https://github.com/jirutka/sloci-image/pull/2

---
 DEVELOPERS                                    |  1 +
 package/Config.in.host                        |  1 +
 ...ues-when-generating-the-OCI-image-co.patch | 55 +++++++++++++++++++
 package/sloci-image/Config.in.host            |  7 +++
 package/sloci-image/sloci-image.hash          |  5 ++
 package/sloci-image/sloci-image.mk            | 19 +++++++
 6 files changed, 88 insertions(+)
 create mode 100644 package/sloci-image/0001-Fix-escaping-issues-when-generating-the-OCI-image-co.patch
 create mode 100644 package/sloci-image/Config.in.host
 create mode 100644 package/sloci-image/sloci-image.hash
 create mode 100644 package/sloci-image/sloci-image.mk
DEVELOPERS +1 -0
index b245c1cd7eee..a0bfde2391a6 100644
@@ -2383,6 +2383,7 @@ F:	package/curlpp/
 F:	package/daq/
 F:	package/libgdiplus/
 F:	package/pimd/
+F:	package/sloci-image/
 F:	package/snort/
 F:	package/stella/
 F:	package/tio/
package/Config.in.host +1 -0
index 546f1c226dec..26ed8480cc21 100644
@@ -76,6 +76,7 @@ menu "Host utilities"
 	source "package/sam-ba/Config.in.host"
 	source "package/sdbusplus/Config.in.host"
 	source "package/sentry-cli/Config.in.host"
+	source "package/sloci-image/Config.in.host"
 	source "package/squashfs/Config.in.host"
 	source "package/sunxi-tools/Config.in.host"
 	source "package/swig/Config.in.host"
package/sloci-image/0001-Fix-escaping-issues-when-generating-the-OCI-image-co.patch new file +55 -0

55 lines not on this page · raw message

package/sloci-image/Config.in.host new file +7 -0
new file mode 100644
index 000000000000..d809f1f3c786
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_HOST_SLOCI_IMAGE
+	bool "host sloci-image"
+	help
+	  A simple CLI tool for packing rootfs into a single-layer OCI
+	  image.
+
+	  https://github.com/jirutka/sloci-image
package/sloci-image/sloci-image.hash new file +5 -0
new file mode 100644
index 000000000000..2476b2340823
@@ -0,0 +1,5 @@
+# Locally computed
+sha256  2c154e355aea65089921058c8ba96cc90e6c22753b4e7956221403b6183ac775  sloci-image-4015e49763e5a738026a5bbfcf32b38b5a4fa650.tar.gz
+
+# Hash for license files:
+sha256  8ea53673b084576813fc40cd63817c5a1619438942b5e6c30dac1d10707c27e4  LICENSE
package/sloci-image/sloci-image.mk new file +19 -0
new file mode 100644
index 000000000000..ab716a074342
@@ -0,0 +1,19 @@
+################################################################################
+#
+# sloci-image
+#
+################################################################################
+
+SLOCI_IMAGE_VERSION = 4015e49763e5a738026a5bbfcf32b38b5a4fa650
+SLOCI_IMAGE_SITE = $(call github,jirutka,sloci-image,$(SLOCI_IMAGE_VERSION))
+
+SLOCI_IMAGE_LICENSE = MIT
+SLOCI_IMAGE_LICENSE_FILES = LICENSE
+
+HOST_SLOCI_IMAGE_DEPENDENCIES = host-gawk
+
+define HOST_SLOCI_IMAGE_INSTALL_CMDS
+	$(HOST_MAKE_ENV) $(MAKE) DESTDIR=$(HOST_DIR) PREFIX=/usr -C $(@D) install
+endef
+
+$(eval $(host-generic-package))
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/2 oci: add new filesystem type

In reply to Sergio Prado

From: Sergio Prado <[email protected]>

Add support to generate OCI (Open Container Initiative) images.

An OCI image consists of a manifest, an image index (optional), a set of filesystem layers, and a configuration. The complete specification is available in the link below:

https://github.com/opencontainers/image-spec/blob/master/spec.md

The image is generated with the host tool sloci-image, and config options can be used to configure image parameters.

By default, the image is generated in a directory called rootfs-oci:

$ cd output/images
$ ls rootfs-oci/
blobs  index.json  oci-layout

Optionally, the image can be packed into a tar archive.

The image can be pushed to a registry using containers tools like skopeo:

$ skopeo copy --dest-creds <user>:<pass> oci:rootfs-oci:<tag> \
	docker://<user>/<image>

And then we can pull/run the container image with tools like docker:

$ docker run -it <user>/<image>:<tag>
---
 fs/Config.in     |  1 +
 fs/oci/Config.in | 88 +++++++++++++++++++++++++++++++++++++++++++
 fs/oci/oci.mk    | 97 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 186 insertions(+)
 create mode 100644 fs/oci/Config.in
 create mode 100644 fs/oci/oci.mk
fs/Config.in +1 -0
index 37a2aa21f8ac..eee5e26bb2b3 100644
@@ -11,6 +11,7 @@ source "fs/f2fs/Config.in"
 source "fs/initramfs/Config.in"
 source "fs/iso9660/Config.in"
 source "fs/jffs2/Config.in"
+source "fs/oci/Config.in"
 source "fs/romfs/Config.in"
 source "fs/squashfs/Config.in"
 source "fs/tar/Config.in"
fs/oci/Config.in new file +88 -0

88 lines not on this page · raw message

fs/oci/oci.mk new file +97 -0

97 lines not on this page · raw message

Signature · 1 line
2.17.1