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:
@@ -0,0 +1,24 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '{version}'
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
bootBuildImage {
|
||||
builder = "projects.registry.vmware.com/springboot/spring-boot-cnb-builder:0.0.2"
|
||||
pullPolicy = "IF_NOT_PRESENT"
|
||||
buildCache {
|
||||
bind {
|
||||
source = System.getProperty('java.io.tmpdir') + "/junit-image-cache-${rootProject.name}-build"
|
||||
}
|
||||
}
|
||||
launchCache {
|
||||
bind {
|
||||
source = System.getProperty('java.io.tmpdir') + "/junit-image-cache-${rootProject.name}-launch"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,10 @@ bootBuildImage {
|
||||
builder = "projects.registry.vmware.com/springboot/spring-boot-cnb-builder:0.0.2"
|
||||
buildCache {
|
||||
volume {
|
||||
name = "build-cache-volume1"
|
||||
name = "build-cache-volume"
|
||||
}
|
||||
volume {
|
||||
name = "build-cache-volum2"
|
||||
bind {
|
||||
name = "/tmp/build-cache-bind"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user