Docker Cache Not Working for Release Builds #160575
Replies: 1 comment
-
|
This usually happens because the cache key is based on One improvement would be to use a more stable cache key, for example based on the branch name or a Dockerfile hash instead of the commit SHA. That way both push and release workflows can reuse the same cache layers. For example: You may also want to consider using Docker Buildx native caching (like |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I am using a GitHub workflow to build and push Docker images for amd64 and arm64 using buildx action. The workflow is triggered in two ways: one by pushing to a branch and the other by creating a release version.The issue is that when the workflow is triggered by a push event, the cache is used effectively, but when triggered by a release, it is not. How can I resolve this?
My assumption is that for push events, caching works because the same branch is used, whereas for releases, it falls outside the expected scope. Is this correct? What would be the best alternative to address this?
Beta Was this translation helpful? Give feedback.
All reactions