godarch / darch

A tool for building and booting stateless and immutable images, bare metal.
https://godarch.com/
MIT License
832 stars 32 forks source link

Add Manifest support for multi-platform builds #65

Closed vanourogeros closed 9 months ago

vanourogeros commented 10 months ago

Hey! I am using some files from this project mainly for modifying images/manifests and I ran into problems when using images with multiple supported platforms, because when I use the LoadManifest() function the manifest returned is a list with all the manifests (mediatype is images.MediaTypeDockerSchema2ManifestList).

To this end, I created a function LoadManifestFromList() that extracts the manifest for a specific platform that can then be used normally. Example usage can be found in the build.go file where it is checked whether the manifest returned by LoadManifest() is a Manifest List and if it is the specific manifest for the runtime os and arch is loaded.

I'm not sure if this is needed for the recipe building or for the aims of this specific project in general, but I created this PR just in case any of this is useful, for my own aims this was needed :)

In any case, thank you for your contributions, this project was really helpful and provided some functionality I could not find anywhere else :)