Skip to content

Commit b4e2269

Browse files
Merge #6592: ci: dockerimage multi cache
c3526dc ci: push / cache docker images based on hash too (pasta) Pull request description: ## Issue being fixed or feature implemented docker/build-push-action allows us to cache from multiple refs; let's use it! I've noticed a lot recently when we are changing docker image we get a lot of cache misses we shouldn't. Now we push an image based on the hash of the dockerfile, and restore from that. Additionally, we can now cache from the branch name. Previously we'd get into situations where: develop is pushed, build image: HIT PR opened that changes image, build image: MISS and push develop is pushed with a different PR, build image: MISS and push PR has new commit added or rebased, build image: MISS and push This PR should allow all of these to hit now. ## What was done? Cache from and push to a tag that is the hash of the dockerfile. Additionally, allow caching from the branch name, or latest if needed. ## How Has This Been Tested? In my own repo, did a situation similiar to as described above, and got cache hits as expected. ## Breaking Changes None ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK c3526dc kwvg: utACK c3526dc Tree-SHA512: de66dd37991cf6c0518a13bb648e9547e816b25da33eb80826522eec54ee4c6fe91f64c9c2cb758836cc40b9558d2db48573f5bb234111adc6da176f641e7e1b
2 parents e008070 + c3526dc commit b4e2269

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

.github/workflows/build-container.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ jobs:
4848
file: ./contrib/containers/ci/Dockerfile
4949
push: true
5050
tags: |
51+
ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:${{ hashFiles('./contrib/containers/ci/Dockerfile') }}
5152
ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:${{ steps.prepare.outputs.tag }}
5253
ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:latest
53-
cache-from: type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:latest
54+
cache-from: |
55+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:${{ hashFiles('./contrib/containers/ci/Dockerfile') }}
56+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:${{ steps.prepare.outputs.tag }}
57+
type=registry,ref=ghcr.io/${{ steps.prepare.outputs.repo }}/dashcore-ci-runner:latest
5458
cache-to: type=inline

0 commit comments

Comments
 (0)