Skip to content

Support caching build layers to a bind mount #28387

@scottfrederick

Description

@scottfrederick

The spring-boot:build-image Maven goal and bootBuildImage Gradle task configure the CNB builder to cache layers created by buildpacks to make subsequent image builds run faster. Currently the cache is stored as named volume in the Docker daemon. This doesn't work well when running builds on BitBucket, as discussed in buildpacks/pack#1077 (comment).

To better support running builds in BitBucket pipelines the Boot plugins could be enhanced to support storing the build and launch caches in bind mounts.

For Maven, the build configuration would be:

<project> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <image> <buildCache> <bind> <source>./build-cache-dir</source> </bind> </buildCache> <launchCache> <bind> <source>./launch-cache-dir</source> </bind> </launchCache> </image> </configuration> </plugin> </plugins> </build> </project> 

For Gradle, the build configuration would be:

bootBuildImage { buildCache { bind { source = "./build-cache-dir" } } launchCache { bind { source = "./launch-cache-dir" } } } 

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions