diff mbox series

[v1,3/3] package/genuinetools-img: new host and target package

Message ID 20210503023305.161122-3-christian@paral.in
State Changes Requested
Headers show
Series [v1,1/3] package/libfuse3: allow building as a host package | expand

Commit Message

Christian Stewart May 3, 2021, 2:33 a.m. UTC
Img is a standalone, daemon-less, unprivileged Dockerfile and OCI compatible
container image builder. It uses the moby-buildkit solver internally. The
commands/UX mirror the Docker CLI for workflow compatibility.

Using the genuinetools- prefix due to the generic nature of the "img" name.

Adds both host and target variants. fuse-overlayfs can be used as an
unprivileged and rootless overlay filesystem backend.

https://github.com/genuinetools/img

Signed-off-by: Christian Stewart <christian@paral.in>
---
 package/Config.in                             |  1 +
 package/Config.in.host                        |  1 +
 package/genuinetools-img/Config.in            | 23 ++++++++++++++++
 package/genuinetools-img/Config.in.host       |  9 +++++++
 .../genuinetools-img/genuinetools-img.hash    |  3 +++
 package/genuinetools-img/genuinetools-img.mk  | 27 +++++++++++++++++++
 6 files changed, 64 insertions(+)
 create mode 100644 package/genuinetools-img/Config.in
 create mode 100644 package/genuinetools-img/Config.in.host
 create mode 100644 package/genuinetools-img/genuinetools-img.hash
 create mode 100644 package/genuinetools-img/genuinetools-img.mk

Comments

Christian Stewart May 3, 2021, 2:45 a.m. UTC | #1
All,


On Sun, May 2, 2021 at 7:33 PM Christian Stewart <christian@paral.in> wrote:
>
> Img is a standalone, daemon-less, unprivileged Dockerfile and OCI compatible
> container image builder. It uses the moby-buildkit solver internally. The
> commands/UX mirror the Docker CLI for workflow compatibility.
>
> Using the genuinetools- prefix due to the generic nature of the "img" name.
>
> Adds both host and target variants. fuse-overlayfs can be used as an
> unprivileged and rootless overlay filesystem backend.
>
> https://github.com/genuinetools/img

The intent here is to eventually add some kind of "download" target to
Buildroot for downloading & verifying container images as .tar.gz
files from container registries using the genuinetools-img tool - it
can "pull" and "save" using an unprivileged cache directory.

I'm not sure the best way to do this / if there is any appetite for
adding a pkg helper for this, thoughts?

Best regards,
Christian Stewart
Yann E. MORIN May 4, 2021, 8:31 p.m. UTC | #2
Christian, All,

On 2021-05-02 19:45 -0700, Christian Stewart spake thusly:
> On Sun, May 2, 2021 at 7:33 PM Christian Stewart <christian@paral.in> wrote:
> >
> > Img is a standalone, daemon-less, unprivileged Dockerfile and OCI compatible
> > container image builder. It uses the moby-buildkit solver internally. The
> > commands/UX mirror the Docker CLI for workflow compatibility.
> >
> > Using the genuinetools- prefix due to the generic nature of the "img" name.
> >
> > Adds both host and target variants. fuse-overlayfs can be used as an
> > unprivileged and rootless overlay filesystem backend.
> >
> > https://github.com/genuinetools/img
> 
> The intent here is to eventually add some kind of "download" target to
> Buildroot for downloading & verifying container images as .tar.gz
> files from container registries using the genuinetools-img tool - it
> can "pull" and "save" using an unprivileged cache directory.
> 
> I'm not sure the best way to do this / if there is any appetite for
> adding a pkg helper for this, thoughts?

Im not usre I understood that, but basically one would write:

    HELLO_WORLD_VERSION = 1.2.3
    HELLO_WORLD_SOURCE = hello-world:1.2.3
    HELLO_WORLD_SITE = dockerhub.com/u/hello

    $(eval $(oci-image-package))

And that would download the hello-world:1.2.3 image from dockerhub and
install that as a OCI image in the target filesystem, so that at runtime
one could do (on the CLI, in an init script, in a systemd unit, etc...):
    docker run hello-world:1.2.3 /bin/hello-world

Something like that?

Regards,
Yann E. MORIN.
Christian Stewart May 4, 2021, 10:03 p.m. UTC | #3
Hi Yann,

On Tue, May 4, 2021 at 1:31 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote
> Im not usre I understood that, but basically one would write:
>
>     HELLO_WORLD_VERSION = 1.2.3
>     HELLO_WORLD_SOURCE = hello-world:1.2.3
>     HELLO_WORLD_SITE = dockerhub.com/u/hello
>
>     $(eval $(oci-image-package))
>
> And that would download the hello-world:1.2.3 image from dockerhub and
> install that as a OCI image in the target filesystem, so that at runtime
> one could do (on the CLI, in an init script, in a systemd unit, etc...):
>     docker run hello-world:1.2.3 /bin/hello-world
>
> Something like that?

Yes, the "download" step would use host "img pull" to download the OCI
image, and then "img save" to store it as a .tar.gz, (which we can
then hash as a downloaded tar.gz file).

The .tar.gz can be loaded into Docker with "docker load < the-image.tar.gz"

The image-package helper could just download the image + save it (to
images dir, optionally).

Best,
Christian
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 7ac10b9d42..f352f6b168 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -2444,6 +2444,7 @@  menu "System tools"
 	source "package/emlog/Config.in"
 	source "package/ftop/Config.in"
 	source "package/getent/Config.in"
+	source "package/genuinetools-img/Config.in"
 	source "package/gkrellm/Config.in"
 	source "package/htop/Config.in"
 	source "package/ibm-sw-tpm2/Config.in"
diff --git a/package/Config.in.host b/package/Config.in.host
index 0dbf63f2c8..391742856d 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -32,6 +32,7 @@  menu "Host utilities"
 	source "package/genext2fs/Config.in.host"
 	source "package/genimage/Config.in.host"
 	source "package/genpart/Config.in.host"
+	source "package/genuinetools-img/Config.in.host"
 	source "package/gnupg/Config.in.host"
 	source "package/go/Config.in.host"
 	source "package/go-bootstrap/Config.in.host"
diff --git a/package/genuinetools-img/Config.in b/package/genuinetools-img/Config.in
new file mode 100644
index 0000000000..eb4992db07
--- /dev/null
+++ b/package/genuinetools-img/Config.in
@@ -0,0 +1,23 @@ 
+config BR2_PACKAGE_GENUINETOOLS_IMG
+	bool "genuinetools-img"
+	depends on BR2_USE_MMU # fuse-overlayfs libfuse3
+	depends on !BR2_STATIC_LIBS # fuse-overlayfs libfuse3
+	depends on BR2_TOOLCHAIN_HAS_THREADS # fuse-overlayfs libfuse3
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15 # fuse-overlayfs
+	depends on BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HOST_GO_TARGET_CGO_LINKING_SUPPORTS
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC
+	select BR2_PACKAGE_CGROUPFS_MOUNT if !BR2_PACKAGE_SYSTEMD # runtime dependency
+	select BR2_PACKAGE_FUSE_OVERLAYFS # runtime dependency
+	select BR2_PACKAGE_LIBFUSE3 # fuse-overlayfs
+	help
+	  Img is a standalone, daemon-less, unprivileged Dockerfile
+	  and OCI compatible container image builder.
+
+	  https://github.com/genuinetools/img
+
+comment "genuinetools-img needs a toolchain w/ threads, dynamic library, headers >= 3.15"
+	depends on BR2_USE_MMU
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_STATIC_LIBS || \
+		!BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_15
diff --git a/package/genuinetools-img/Config.in.host b/package/genuinetools-img/Config.in.host
new file mode 100644
index 0000000000..bbef88acf6
--- /dev/null
+++ b/package/genuinetools-img/Config.in.host
@@ -0,0 +1,9 @@ 
+config BR2_PACKAGE_HOST_GENUINETOOLS_IMG
+	bool "host genuinetools-img"
+	depends on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS
+	select BR2_PACKAGE_HOST_FUSE_OVERLAYFS # runtime dependency
+	help
+	  Img is a standalone, daemon-less, unprivileged Dockerfile
+	  and OCI compatible container image builder.
+
+	  https://github.com/genuinetools/img
diff --git a/package/genuinetools-img/genuinetools-img.hash b/package/genuinetools-img/genuinetools-img.hash
new file mode 100644
index 0000000000..097ad17d91
--- /dev/null
+++ b/package/genuinetools-img/genuinetools-img.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated
+sha256  c6d805ab899db639fa08f0e33fe6673593be8336d288bb1cb4cb81a3229a916f  genuinetools-img-0.5.11.tar.gz
+sha256	c696614021eafe355c7fb0af3e724fc7fa8729a0c10c27cbed2505bf30a853ce  LICENSE
diff --git a/package/genuinetools-img/genuinetools-img.mk b/package/genuinetools-img/genuinetools-img.mk
new file mode 100644
index 0000000000..08330d1113
--- /dev/null
+++ b/package/genuinetools-img/genuinetools-img.mk
@@ -0,0 +1,27 @@ 
+################################################################################
+#
+# genuinetools-img
+#
+################################################################################
+
+GENUINETOOLS_IMG_VERSION = 0.5.11
+GENUINETOOLS_IMG_SITE = $(call github,genuinetools,img,v$(GENUINETOOLS_IMG_VERSION))
+
+GENUINETOOLS_IMG_LICENSE = MIT
+GENUINETOOLS_IMG_LICENSE_FILES = LICENSE
+
+GENUINETOOLS_IMG_DEPENDENCIES = host-pkgconf
+GENUINETOOLS_IMG_GOMOD = github.com/genuinetools/img
+
+GENUINETOOLS_IMG_TAGS = cgo noembed
+GENUINETOOLS_IMG_LDFLAGS = \
+	-X $(GENUINETOOLS_IMG_GOMOD)/version.VERSION="$(GENUINETOOLS_IMG_VERSION)"
+
+HOST_GENUINETOOLS_IMG_TAGS = $(GENUINETOOLS_IMG_TAGS)
+HOST_GENUINETOOLS_IMG_LDFLAGS = $(GENUINETOOLS_IMG_LDFLAGS)
+
+HOST_GENUINETOOLS_IMG_BIN_NAME = genuinetools-img
+HOST_GENUINETOOLS_IMG_INSTALL_BINS = $(HOST_GENUINETOOLS_IMG_BIN_NAME)
+
+$(eval $(golang-package))
+$(eval $(host-golang-package))