The extension assumes that the project is building a "native image" (a single executable binary) using the GraalVM's native-image-maven-plugin (source). The native-image plugin does the heavy lifting, so this extension just needs to locate and copy the executable.
Some more details,
Resets existing layers and create a new layer container a single "native-image" binary (though preserving "extra directories layers.")
Auto-set container entrypoint to /app/<native-image> if not set in main Jib configuration.
Infers the native-image binary name from various locations.
The extension allows overriding the native-image name with the "imageName" property.
Figure out what to do with Gradle since there doesn't seem to be a definitive Gradle native-image plugin. Perhaps we can just make the executable path explicitly configurable.
General note about building a container image for a native image:
As explained in https://github.com/GoogleContainerTools/jib/pull/2268, the native-image binary should be built on the same architecture as the architecture used at runtime, since native-image doesn't support cross-compilation. Otherwise, you may get into a puzzling error:
$ docker run -it --rm native-hello
standard_init_linux.go:211: exec user process caused "exec format error"
The extension assumes that the project is building a "native image" (a single executable binary) using the GraalVM's
native-image-maven-plugin
(source). The native-image plugin does the heavy lifting, so this extension just needs to locate and copy the executable.Some more details,
/app/<native-image>
if not set in main Jib configuration.I've consulted our previous https://github.com/GoogleContainerTools/jib/pull/2268 as well as the native-image-maven-plugin source.
We'll want to add an example too.
(from https://github.com/GoogleContainerTools/jib/pull/2268)
General note about building a container image for a native image:
As explained in https://github.com/GoogleContainerTools/jib/pull/2268, the native-image binary should be built on the same architecture as the architecture used at runtime, since
native-image
doesn't support cross-compilation. Otherwise, you may get into a puzzling error: