spring-projects / spring-projects/spring-boot
Support caching build layers to an image
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
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 CI/CD environments, since Docker daemons might be ephemeral or builds might run on different worker nodes.
To better support running builds on CI/CD environments, the CNB builder supports storing cached layers in an OCI image. The Boot plugins could be enhanced to support this configuration also.
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>
<image>
<name>repo.example.com/cache-${project.artifactId}:latest</name>
</image>
</buildCache>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
For Gradle, the build configuration would be:
bootBuildImage {
buildCache {
image {
name = "repo.example.com/cache-${rootProject.name}:latest"
}
}
}
Note: the image option is not available for the launch cache, only for the build cache.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the spring-boot:build-image Maven goal and bootBuildImage Gradle task, then trace how each configures CNB build caching and Docker volumes. Add support for selecting an OCI image for the build cache in both plugin configurations, while leaving launch-cache image support unavailable. Verify the Maven and Gradle examples and confirm cached layers can be reused across workers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, java, spring-boot
- Domain
- build-system, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100