Subject: [bug#62153] [PATCH 1/2] guix: docker: Build layered image.

From: Simon Tournier <[email-masked]>
Date: Mon, 13 Mar 2023 16:01:04 +0100

Hi,

Oh cool!  Awesome!  Thanks for pushing forward.

On lun., 13 mars 2023 at 03:33, Oleg Pykhalov <[email-masked]> wrote:

> diff --git a/gnu/packages/aux-files/python/stream-layered-image.py b/gnu/packages/aux-files/python/stream-layered-image.py
> new file mode 100644
> index 0000000000..9ad2168c2d
> --- /dev/null
> +++ b/gnu/packages/aux-files/python/stream-layered-image.py
> @@ -0,0 +1,391 @@
> +"""
> +This script generates a Docker image from a set of store paths. Uses
> +Docker Image Specification v1.2 as reference [1].

Instead of Python, would it possible to implement in Guile?  I mean,
does Python have something that is missing in Guile?

The facility for manipulating Tar?  Something else?

Because then, if I understand correctly…

> diff --git a/guix/docker.scm b/guix/docker.scm
> index 5e6460f43f..f1adad26dc 100644
> --- a/guix/docker.scm
> +++ b/guix/docker.scm

[...]

> +      (if stream-layered-image
> +          (let ((input (open-pipe* OPEN_READ "python3"
> +                                   stream-layered-image
> +                                   "config.json")))

…it requires to drag Python for building/packing layered Docker.

Well, I have not really look yet to the Python script which does most of
the job.  Do you use a similar strategy as [1]?

And I remember something in that direction by Chris but I am unable to
find back the patch. )-:

1: https://grahamc.com/blog/nix-and-layered-docker-images/

Cheers,
simon