build: setup cache to build images in CI #204
Merged
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.
Description:
This PR setups
docker/build-push-action
cache in the workflow to improve building images in CI.After the cache is filled, most of the
docker/build-push-action
step output should look likeThis reduces the workflow runtime from about an hour to a about minute when hitting the cache!
Note
Each
docker/build-push-action
step needs to setup its own scope to avoid overwriting its cache between steps. The docs here regardingscope
are not clear about this behavior. However, the usage ofscope
forbuildx
here is more descriptive.Important
To avoid any surprises regarding cache management, please be aware that GitHub's cache access restrictions still apply.
But on the other hand
You can inspect the branches a
docker/build-push-action
step has access to in the logs underGitHub Actions runtime token ACs
groupRelated issue(s):
Fixes #203.
Notes for reviewer:
This feature was implemented with several trials and errors to get these settings right. Each
docker/build-push-action
step was enabled one at a time to ensure the cache was filled successfully. In subsequent runs I could verify that the cache for a previous run was used.Checklist