I followed the steps from build quarkus native executable .
1.Bootstrapping the project:
mvn io.quarkus:quarkus-maven-plugin:0.11.0:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=getting-started \
-DclassName="org.acme.quickstart.GreetingResource" \
-Dpath="/hello"
2.Use docker in minishift
minishift start
eval $(minishift docker-env)
3.Generate package:
mvn package -Pnative -Dnative-image.docker-build=true
failed with the error trace below:
[INFO] [io.quarkus.creator.phase.nativeimage.NativeImagePhase] docker run -v /Users/.../quarkus/getting-started/target:/project:z --rm swd847/centos-graal-native-image-rc12 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar getting-started-1.0-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:+PrintAnalysisCallTree -H:EnableURLProtocols=http -H:-SpawnIsolates -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace
Error: Invalid Path entry getting-started-1.0-SNAPSHOT-runner.jar
Caused by: java.nio.file.NoSuchFileException: /project/getting-started-1.0-SNAPSHOT-runner.jar
As requested, the tree output is shown below:
The -Dnative-image.docker-build=true
feature of Quarkus will only work with the local docker daemon.
In your case you are using the Docker daemon from Minishift and the build files because the build artifacts are not present in the Minishift VM.
UPDATE
There is now a Quarkus issue that tracks this.
I think the best way is to combine the process of creating the application image and the actual compilation into one Dockerfile.
Your Dockerfile should contain 3 stages
First stage is for the fast fail if app has compilation issues ++ to build the jar file
Second stage is to produce native image from the jar + libs via native-image command or you can use "mvn -Pnative verify" if you are using an image which contains both maven and graalvm.
Third stage is to build the final Docker image based on the compiled native image and minimal base image such as alpine or fedora-minimal
An example of building the app ++ building the native image ++ building the final Docker image - https://github.com/quarkusio/quarkus-quickstarts/blob/master/getting-started-knative/Dockerfile
The related Issue has been resolved at Quarkus github and remote container support is here.
Quoting the resolution comment:
Building native images using a remote docker daemon has been implemented and merged for Quarkus 1.13 (PR #14635). Just use the flag
-Dquarkus.native.remote-container-build=true
instead of-Dquarkus.native.container-build=true
.
So if you using minishift or minikube just use the new option while building.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.