이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 1. Producing a native executable
You can produce a native executable from your Quarkus application using a container runtime such as Podman or Docker. Quarkus produces a binary executable using a builder image, which you can use together with the Red Hat Universal Base Images RHEL8-UBI and RHEL8-UBI minimal. Red Hat build of Quarkus 1.11 uses registry.access.redhat.com/quarkus/mandrel-20-rhel8:20.3 as a default for the quarkus.native.builder-image property.
The native executable for your application contains the application code, required libraries, Java APIs, and a reduced version of a virtual machine (VM). The smaller VM base improves the startup time of the application and produces a minimal disk footprint.
Procedure
Open the Getting Started project
pom.xmlfile and verify that it includes thenativeprofile:Copy to Clipboard Copied! Toggle word wrap Toggle overflow NoteUsing Quarkus
nativeprofile allows you to run both the native executable and the native image tests.Build a native executable using one of the following methods:
Build a native executable with Docker:
./mvnw package -Pnative -Dquarkus.native.container-build=true
./mvnw package -Pnative -Dquarkus.native.container-build=trueCopy to Clipboard Copied! Toggle word wrap Toggle overflow Build a native executable with Podman:
./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podman
./mvnw package -Pnative -Dquarkus.native.container-build=true -Dquarkus.native.container-runtime=podmanCopy to Clipboard Copied! Toggle word wrap Toggle overflow These commands create the
getting-started-*-runnerbinary in thetargetdirectory.ImportantCompiling a Quarkus application to a native executable consumes a lot of memory during analysis and optimization. You can limit the amount of memory used during native compilation by setting the
quarkus.native.native-image-xmxconfiguration property. Setting low memory limits might increase the build time. For more details, refer to Native executable configuration properties.
Run the native executable:
./target/getting-started-*-runner
./target/getting-started-*-runnerCopy to Clipboard Copied! Toggle word wrap Toggle overflow When you build the native executable the
prodprofile is enabled and the Quarkus native tests run using theprodprofile. You can change this using thequarkus.test.native-image-profileproperty.