Example request: SubstrateVM
I found https://github.com/GoogleContainerTools/distroless/issues/217 when googling why I was encountering the error about the library libz.so.1 being missing when trying to launch a container from an image I built based on gcr.io/distroless/base-debian11.
I like the solution proposed in that issue where instead of maintaining many base images, there are examples for users to use multi stage builds to copy in the shared libraries they need to run their binaries. But after adding the line in that issue recommended (COPY --from=build-env /lib/x86_64-linux-gnu/libz.so.1 /lib/x86_64-linux-gnu/libz.so.1), it solved the first error I got trying to run my container, but I got new errors:
/app: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /app)
/app: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /app)
It looks like there's more I need and I'm not familiar with shared libraries (I've coded Go and Node.js where I didn't have to worry about them, and GraalVM is the first time I'm encountering this concept), so it'd be nice to have an up to date example. I checked the examples for Java, which brought me to https://github.com/GoogleContainerTools/distroless/blob/main/examples/java/Dockerfile, but that appears to only be about running JARs.
Looks like I was able to solve my particular problem by running ./gradlew dockerBuildNative and using the Docker image that command produced instead of running ./gradlew nativeCompile and then building an image using the binary produced by that command and my own Dockerfile (based on the Dockerfile in https://github.com/GoogleContainerTools/distroless/issues/217 from a few years ago). So I think this was my own error causing me to run into this problem. In this case, I wasn't aware that if you don't build the native binary from within a GraalVM Docker image, it won't work as well.
Based on what happened, maybe this should be closed if you think my use case (Micronaut) was too niche to warrant an example here.