I'm trying to build a ballerina application using the GraalVM native image compiler by following this doc (https://ballerina.io/learn/build-a-native-executable) and getting the following error during the docker image build phase.
Error:
> [build 4/4] RUN sh build-native.sh my_service.jar my_service:
#0 3.676 WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
#0 3.678 WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
#0 3.680 WARNING: Unknown module: org.graalvm.nativeimage.llvm specified to --add-exports
#0 59.74 ========================================================================================================================
#0 59.74 GraalVM Native Image: Generating 'my_service' (executable)...
#0 59.76 ========================================================================================================================
#0 75.84 Error: Image build request failed with exit status 137
------
ERROR: failed to solve: executor failed running [/bin/sh -c sh build-native.sh my_service.jar my_service]: exit code: 137
error [k8s plugin]: module [wso2/my_service:0.1.0] docker build failed. refer to the build log
warning: Detected conflicting jar files:
'ballerina-rt-2201.4.0.jar' dependency of 'wso2/my_service' conflict with 'opentelemetry-api-1.0.0.jar' dependency of 'ballerinax/jaeger'
Env info:
JDK : 11.0.18 (arm64) "Eclipse Adoptium" - "OpenJDK 11.0.18"
GraalVM : graalvm-ce-java11-darwin-aarch64-22.3.1
Exit code 137 suggests an out of memory issue. Increasing the memory allocated to docker fixes the issue. Since GraalVM build consumes significant amount of memory, it is advisable to have atleast 8GB allocated to docker. (Refer to the prerequisites for docker build)