diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/ContainerImageJibConfig.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/ContainerImageJibConfig.java index 8ff58ffc172a7..d9988bc6b79c5 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/ContainerImageJibConfig.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/ContainerImageJibConfig.java @@ -227,4 +227,18 @@ public class ContainerImageJibConfig { */ @ConfigItem(defaultValue = "true") public boolean useCurrentTimestampFileModification; + + /** + * The directory to use for caching base image layers. + * If not specified, the Jib default directory is used. + */ + @ConfigItem + public Optional baseImageLayersCache; + + /** + * The directory to use for caching application layers. + * If not specified, the Jib default directory is used. + */ + public Optional applicationLayersCache; + } diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java index aadd239c1c265..226efb4f0edc6 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java @@ -319,6 +319,9 @@ private Containerizer createContainerizer(ContainerImageConfig containerImageCon containerizer.setAllowInsecureRegistries(containerImageConfig.insecure); containerizer.setAlwaysCacheBaseImage(jibConfig.alwaysCacheBaseImage); containerizer.setOfflineMode(jibConfig.offlineMode); + jibConfig.baseImageLayersCache.ifPresent(cacheDir -> containerizer.setBaseImageLayersCache(Paths.get(cacheDir))); + jibConfig.applicationLayersCache.ifPresent(cacheDir -> containerizer.setApplicationLayersCache(Paths.get(cacheDir))); + return containerizer; }