Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy a Micronaut application to AWS Lambda as an ARM64 native-image #255

Closed
msailes opened this issue Dec 3, 2021 · 3 comments · Fixed by #369
Closed

Deploy a Micronaut application to AWS Lambda as an ARM64 native-image #255

msailes opened this issue Dec 3, 2021 · 3 comments · Fixed by #369
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working
Milestone

Comments

@msailes
Copy link

msailes commented Dec 3, 2021

I'd like to be able to build and deploy my Micronaut application to the ARM architecture on AWS Lambda.

Following the guide https://guides.micronaut.io/latest/mn-application-aws-lambda-graalvm-maven-java.html

$ ./mvnw package -Dpackaging=docker-native -Dmicronaut.runtime=lambda -Pgraalvm

gives me to following error on my MacBook Pro M1

[INFO] Removing intermediate container 14ec5ea17c9b
[INFO]  ---> ee5c7203c1a9
[INFO] Step 8/22 : RUN /usr/lib/graalvm/bin/gu install native-image
[INFO] 
[INFO]  ---> Running in 64fad8633c98
[INFO] /lib64/ld-linux-x86-64.so.2: No such file or directory

[ERROR] The command '/bin/sh -c /usr/lib/graalvm/bin/gu install native-image' returned a non-zero code: 255
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:22 min
[INFO] Finished at: 2021-12-03T14:16:20Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.micronaut.build:micronaut-maven-plugin:3.0.2:docker-native (default-docker-native) on project complete: Execution default-docker-native of goal io.micronaut.build:micronaut-maven-plugin:3.0.2:docker-native failed: Could not build image: The command '/bin/sh -c /usr/lib/graalvm/bin/gu install native-image' returned a non-zero code: 255 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

I believe this is because https://github.com/micronaut-projects/micronaut-maven-plugin/blob/master/src/main/resources/dockerfiles/DockerfileAwsCustomRuntime specifically targets the x86 version of GraalVM.

@timyates
Copy link
Contributor

Related (for gradle) micronaut-projects/micronaut-gradle-plugin#365

@alvarosanchez alvarosanchez added the type: bug Something isn't working label Mar 20, 2022
@alvarosanchez
Copy link
Member

We need to make OS and architecture variables as we do with Java version etc.

In the meantime, the workaround is to run:

./mvnw mn:dockerfile -Dpackaging=docker-native -Dmicronaut.runtime=lambda

To generate the Dockerfile, then copy it to the project's root and make the change yourself.

@alvarosanchez alvarosanchez added the info: workaround available A workaround is available for the issue label Mar 20, 2022
@alvarosanchez
Copy link
Member

Related: #333

@alvarosanchez alvarosanchez added this to the 3.2.4 milestone Apr 28, 2022
@alvarosanchez alvarosanchez added status: pr submitted A pull request has been submitted for the issue and removed info: workaround available A workaround is available for the issue labels May 5, 2022
alvarosanchez added a commit that referenced this issue May 6, 2022
…ed (#369)

* Make the GraalVM architecture a variable that is automatically detected

Fixes #255

* Add documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: pr submitted A pull request has been submitted for the issue type: bug Something isn't working
Projects
None yet
3 participants