Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add image indexes for multi-arch containers #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thefloweringash
Copy link
Contributor

@thefloweringash thefloweringash commented Jul 9, 2022

It wasn't obvious to me how this worked at all. I thought it was sufficient to put a list of image manifests into a single directory in index.json. However, it seems like this is a less formal grouping of images. A multi-arch image is instead a directory of a single manifest, where that manifest is an image index, and that image index has a list of image manifests.


I should try to share more code between the python scripts.

@thefloweringash
Copy link
Contributor Author

I should try to share more code between the python scripts.

This is slightly harder than I expected, and there's about one function that's worth sharing. I think I'll leave this as is.

@thefloweringash thefloweringash marked this pull request as ready for review July 11, 2022 05:22
@thefloweringash thefloweringash force-pushed the multi-arch branch 2 times, most recently from 051acab to 93a5c1e Compare August 19, 2022 02:49
If two sources of blobs were being merged, the read-only permissions
of the "sha256" directory would propagate which prevented any further
blobs from being combined.
@thatsmydoing
Copy link
Contributor

So this would be used as

oci.makeImageDirectory {
  name = "foo";
  manifests = [(oci.makeImageIndex {
    name = "myimage";
    images = [ myimage-x86_64 myimage-arm64 ];
  })];
}

?

I should try to share more code between the python scripts.

This is slightly harder than I expected, and there's about one function that's worth sharing. I think I'll leave this as is.

Maybe it makes sense to consolidate everything into a single python script (aside from the layer builder itself)?

@thefloweringash
Copy link
Contributor Author

So this would be used as

oci.makeImageDirectory {
  name = "foo";
  manifests = [(oci.makeImageIndex {
    name = "myimage";
    images = [ myimage-x86_64 myimage-arm64 ];
  })];
}

?

Indeed. The associated pull request has a more complete example of building an image with multiple architectures:

let
  makeImage = name: systems: makeSpec:
     let
       images = lib.forEach systems (system:
         let deps = packagesBySystem."${system}"; in
         ociTools.makeImageManifest ({
           architecture = deps.pkgs.go.GOARCH;
           os = deps.pkgs.go.GOOS;
         } // makeSpec deps)
       );
     in
       ociTools.makeImageDirectory {
         inherit name;
         manifests = [
           (ociTools.makeImageIndex {
             inherit name images;
           })
         ];
       };
in # ...

I should try to share more code between the python scripts.

This is slightly harder than I expected, and there's about one function that's worth sharing. I think I'll leave this as is.

Maybe it makes sense to consolidate everything into a single python script (aside from the layer builder itself)?

I don't mind the scripts being distinct entry points, I find it fairly easy to reason about. I do think we could benefit from sharing some more code, maybe like an OCIBuilder that handles the file layout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants