paketo-buildpacks / libpak

An opinionated extension to the libcnb Cloud Native Buildpack Library
Apache License 2.0
15 stars 17 forks source link

Modify create-package to bundle dependencies in a multi-arch offline image #326

Open dmikusa opened 4 months ago

dmikusa commented 4 months ago

Expected Behavior

When you run create-package there is the --include-dependencies option which downloads and caches all of the deps into the resulting image. This presently assumes there's one image. With the introduction of multi-arch images, the behavior needs to change to support that.

Possible Solution

  1. Download all of the images.
  2. Bundle only dependencies specific to a particular architecture of the image of that architecture.

For example, the folder structure for multi-arch is linux/<arch>/... so it would make linux/amd64/dependencies and linux/arm64/dependencies and put the images specific to each architecture in those directories.

In libpak, we call cache.Artifact for each artifact, but the cache controls where the files are written so this will likely require setting up two separate caches and then calling the correct cache per artifact (based on its type), or modifying the cache itself to be architecture aware. If the cache itself stored files under sub folders with the architecture name, then you could easily move parts of the cache into the linux/<arch>/dependencies directory after caching everything.

I do think that we should wait on this until we switch to using the arch metadata field in libpak.

Motivations

Multi-arch support.