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

possible to support ARM images? #23

Closed
larrycai opened this issue Dec 16, 2022 · 3 comments
Closed

possible to support ARM images? #23

larrycai opened this issue Dec 16, 2022 · 3 comments

Comments

@larrycai
Copy link

I try to learn it using minikube@Mac M1, but the image doesn't exist and I tried to rebuild

$ podman build -t quay.io/ruben/cloudevents-player:latest -f src/main/docker/Dockerfile.native .
STEP 1/6: FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3
Trying to pull registry.access.redhat.com/ubi8/ubi-minimal:8.3...
Getting image source signatures
Checking if image destination supports signatures
Copying blob sha256:56a04d997355c19a50990df9442628967dba3293799b2c058e9e6feae7c00e91
Copying blob sha256:9f2d1a2655b9b1c4e7a454a14b61d91972c2d9c6b5936eca839a994cf6483017
Copying config sha256:161b5eee3a1af34f1f9432ca11debf7abef432824a12418508256c38d1de18fa
Writing manifest to image destination
Storing signatures
STEP 2/6: WORKDIR /work/
--> 0db0961f608
STEP 3/6: COPY target/*-runner /work/application
Error: building at STEP "COPY target/*-runner /work/application": checking on sources under "/var/tmp/libpod_builder2131162895/build": Rel: can't make  relative to /var/tmp/libpod_builder2131162895/build; copier: stat: ["/target/*-runner"]: no such file or directory

Possible to provide arm image or fix dockerfile for it?

@ruromero
Copy link
Owner

ruromero commented Dec 19, 2022

Hey @larrycai
The error is telling you that the target/cloudevent-player-1.1-SNAPSHOT-runner file does not exist. You could run the mvn clean install -native that generates the native binary and then it runs the docker/podman build locally.

the ubi-minimal:8.3 image is multi-arch and you should be able to build your arm64 image locally with this same command.

If you don't want to do the build locally, you can try the multi-stage build that I have provided in PR #22 (but I haven't tested it properly)

@larrycai
Copy link
Author

larrycai commented Dec 20, 2022

I thought the build was inside the container build as well (I haven't touched java for a while)

tried below

$ brew install maven
$ mvn clean install -Pnative
...
[INFO] Finished at: 2022-12-20T13:43:38+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.0.1.Final:build (default) on project cloudevent-player: Failed to build quarkus application: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
[ERROR]         [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: java.lang.RuntimeException: Cannot find the `native-image` in the GRAALVM_HOME, JAVA_HOME and System PATH. Install it using `gu install native-image`
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.getNativeImageBuildRunner(NativeImageBuildStep.java:260)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:155)
[ERROR]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:578)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:820)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2442)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1476)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:1589)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[ERROR] -> [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/MojoExecutionException

Maybe it is simple to fix by java developers, but not me now ;-)

And pull with latest (after PR #22) and

$ mvn clean install -Pnative -Dquarkus.native.container-build=true
...
INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   MessageResourceTest.getAll:32 1 expectation failed.
Expected status code <200> but was <500>.

[ERROR]   MessageResourceTest.sendEvent:47 1 expectation failed.
Expected status code <202> but was <500>.

[INFO] 
[ERROR] Tests run: 2, Failures: 2, Errors: 0, Skipped: 0
[INFO] 

Skip the testing to have image ready

$ mvn package -Pnative -Dquarkus.native.container-build=true -Dmaven.test.skip=true
... 
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] podman run --env LANG=C --rm -v /Users/RDCCAIY/git/github/cloudevents-player/target/cloudevent-player-1.2-SNAPSHOT-native-image-source-jar:/project:z --name build-native-zWVzc quay.io/quarkus/ubi-quarkus-mandrel-builder-image:22.3-java17 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dlogging.initial-configurator.min-level=500 -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=SE -J-Dfile.encoding=UTF-8 --features=io.quarkus.websockets.client.runtime.DisableLoggingFeature,io.quarkus.runner.Feature,io.quarkus.runtime.graal.ResourcesFeature,io.quarkus.runtime.graal.DisableLoggingFeature,io.quarkus.hibernate.validator.runtime.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:+CollectImageBuildStatistics -H:ImageBuildStatisticsFile=cloudevent-player-1.2-SNAPSHOT-runner-timing-stats.json -H:BuildOutputJSONFile=cloudevent-player-1.2-SNAPSHOT-runner-build-output-stats.json -H:+AllowFoldMethods -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+ReportExceptionStackTraces -H:-AddAllCharsets --enable-url-protocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED -J--add-exports=org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk=ALL-UNNAMED cloudevent-player-1.2-SNAPSHOT-runner -jar cloudevent-player-1.2-SNAPSHOT-runner.jar
Error: preparing container cd91198ef40ddefb42ff2600a1550d884c10bef17ec4c33a99d687e6219c4e4d for attach: lsetxattr /Users/guest/git/github/cloudevents-player/target/cloudevent-player-1.2-SNAPSHOT-native-image-source-jar/lib: operation not supported
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
...

Try to make it work locally in Mac (also for folder sharing in qemu), give up. But will try to find other ways like multi-arch

@ruromero
Copy link
Owner

I have fixed an issue with the integrationTests and I've also created a GitHub action to perform a multi-arch build. You can check quay.io/ruben/cloudevents-player:v1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants