Demonstrates how to produce a native binary using Graal Native Image in conjunction with a Kotlin JVM shadow JAR.
Requires Gradle (recommend latest, 7.3+).
Install GraalVM 23.1.0+ for your platform: https://github.com/graalvm/graalvm-ce-builds/releases/tag/vm-21.3.0. Use gu to install native-image (gu install native-image). Set this as your current Java.
Now you can build an executable native binary with gradle buildNative. It outputs the binary into the build/bin directory. Run it like any other platform binary, ex. ./build/bin/native-cli:
To build a Docker image (Debian Linux), build the JAR first: gradle build, and then the docker image: docker build -tag <your-image-name-here> . You can now run it:
docker run -it --rm <your-image-name-here>