Open chanseokoh opened 3 years ago
I would greatly appreciate this feature
Is there currently a way this can be achieved via a custom jib extension? looking though the API, the build plan still just has a list of platforms, I don't see a way to configure a different extraFiles layer for each platform
I'm very interested in this issue. My use case is that I have an application that builds using Gradle. I use a Gradle plugin to create a JRE, using jlink, for each OS/Arch the app is available for. I want to containerize the app for different architectures. I'm using distroless/java-base-debian11
as a base image. Accordingly, I need to provide a unique set of file inputs (the arch-specific JRE) per platform.
@chanseokoh I have a design/prototype of jib changes for this that I'd appreciate feedback on. See #3941 . Is this modeling approach of interest to the maintainers? Do you have other ideas/ways you'd prefer to see this done? Should I pursue fleshing this out more? Etc.
In short, the design adds a LayerObject
, the PlatformDependentLayer
, that maps is essentially a Map<Platform, FileEntriesLayer>
. jib-core
uses the platform of the base image to select the FileEntriesLayer
when constructing the image. The container-build-plan-spec.md
in the draft PR gives a decent representation of how this works.
The prototype does work, and I've used it to make multi-arch images, but it's just a prototype.
Might be a little off-topic: The Gradle OCI Plugin (https://github.com/SgtSilvio/gradle-oci) might be interesting for those wanting fine-grained configuration per platform.
Our use case involves different versions of a Java agent (YourKit specifically) – one for amd64
and one for arm64
. We package a Java agent lib file into the image and it would be very convenient if we could specify different files for different target architectures. We have contemplated mapping the agent lib as a volume, but that seems to be a bit fragile.
Per-platform files for multi-platform images would have solved this. Thanks.
I think this is a low priority work at the moment.
For multi-platform image building, the user may want to provide different binaries and files for different platforms.