feat: add deterministic build support for consistent layer caching#4
Draft
klit79 wants to merge 8 commits intospring-boot-actions:v4from
Draft
feat: add deterministic build support for consistent layer caching#4klit79 wants to merge 8 commits intospring-boot-actions:v4from
klit79 wants to merge 8 commits intospring-boot-actions:v4from
Conversation
Experimental support for both `tools` and `layertools` for `-Djarmode` option
Add optional `deterministic` input to normalize file timestamps and
permissions in extracted Spring Boot layers. This ensures identical
file contents produce identical Docker layer hashes, enabling proper
layer caching across builds.
Changes:
- Add `deterministic` input to action.yml (default: false)
- Update spring-boot-bake.sh to pass deterministic flag
- Modify Dockerfile to normalize timestamps (202301010000.00) and
permissions (644/755) when deterministic=true
- Applied to both jarmode=tools and jarmode=layertools extraction
Benefits:
- Dramatically reduces image pull times (only changed layers download)
- Fixes issue where dependency layers re-download on every pull
- Backward compatible (opt-in feature)
- Works with all cache backends (registry, GHA, inline)
Usage:
uses: spring-boot-actions/spring-boot-bake@v4
with:
deterministic: true
- add chown 0:0 to reset ownership to root for all extracted files - update comments to reflect ownership normalization alongside timestamps and permissions - apply ownership reset in both Spring Boot 3.2+ and legacy extraction paths
715fbee to
da9693b
Compare
120cbb5 to
7a9cb83
Compare
…erministic-builds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Spring Boot layer extraction creates files with random timestamps and ownership, causing Docker layer hashes to change even when dependencies are unchanged. This forces full re-downloads on every image pull.
Solution
Add
deterministic: trueoption that normalizes:Usage