Add support for caching to bind mounts when building images
When building an image using the Maven `spring-boot:build-image` goal or the Gradle `bootBuildImage` task, the build and launch caches can be configured to use a bind mount as an alternative to using a named volume. Closes gh-28387
This commit is contained in:
@@ -420,6 +420,13 @@ The cache volumes can be configured to use alternative names to give more contro
|
||||
include::../maven/packaging-oci-image/caches-pom.xml[tags=caches]
|
||||
----
|
||||
|
||||
The caches can be configured to use bind mounts instead of named volumes, as shown in the following example:
|
||||
|
||||
[source,xml,indent=0,subs="verbatim,attributes",tabsize=4]
|
||||
----
|
||||
include::../maven/packaging-oci-image/bind-caches-pom.xml[tags=caches]
|
||||
----
|
||||
|
||||
[[build-image.examples.docker]]
|
||||
=== Docker Configuration
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- tag::caches[] -->
|
||||
<project>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<image>
|
||||
<buildCache>
|
||||
<bind>
|
||||
<source>/tmp/cache-${project.artifactId}.build</source>
|
||||
</bind>
|
||||
</buildCache>
|
||||
<launchCache>
|
||||
<bind>
|
||||
<source>/tmp/cache-${project.artifactId}.launch</source>
|
||||
</bind>
|
||||
</launchCache>
|
||||
</image>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
<!-- end::caches[] -->
|
||||
Reference in New Issue
Block a user