diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java index 01c8f851f692a..7ee2993cbd908 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/PackageConfig.java @@ -128,6 +128,27 @@ public class PackageConfig { @ConfigItem public Optional appcdsBuilderImage; + /** + * Whether creation of the AppCDS archive should run in a container if available. + * + *

+ * Normally, if either a suitable container image to create the AppCDS archive inside of + * can be determined automatically or if one is explicitly set using the + * {@code quarkus.package.appcds-builder-image} setting, the AppCDS archive is generated by + * running the JDK contained in the image as a container. + * + *

+ * If this option is set to {@code false}, a container will not be used to generate the + * AppCDS archive. Instead, the JDK used to build the application is also used to create the + * archive. Note that the exact same JDK version must be used to run the application in this + * case. + * + *

+ * Ignored if {@code quarkus.package.create-appcds} is set to {@code false}. + */ + @ConfigItem(defaultValue = "true") + public boolean appcdsUseContainer; + /** * This is an advanced option that only takes effect for the mutable-jar format. *

diff --git a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java index 66da8f0954da1..06b53d8c64671 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/pkg/steps/AppCDSBuildStep.java @@ -102,7 +102,9 @@ public void build(Optional appCDsRequested, private String determineContainerImage(PackageConfig packageConfig, Optional appCDSContainerImage) { - if (packageConfig.appcdsBuilderImage.isPresent()) { + if (!packageConfig.appcdsUseContainer) { + return null; + } else if (packageConfig.appcdsBuilderImage.isPresent()) { return packageConfig.appcdsBuilderImage.get(); } else if (appCDSContainerImage.isPresent()) { return appCDSContainerImage.get().getContainerImage();