Caching build of Docker actions
See original GitHub issueDescribe the enhancement
In my opinion, in the case of Docker actions, in many cases it is worthwhile to provide the cache for actions build. At least for published in the marketplace, it is possible to pre-build them by GitHub Actions and store as cache.
Currently, Docker actions are built multiple times as the first step of all builds, which is extremely inefficient for complex Docker actions.
Code Snippet This is due to the way the GitHub Actions worker works.
Additional information
The issue actions/toolkit#47 has been closed indicating a reference to @actions/cache
, which however is limited to user data cache only. In this case, we do not have user data, but public actions, and the process is not controlled by the user at this stage (yet).
Issue Analytics
- State:
- Created 4 years ago
- Reactions:62
- Comments:7 (3 by maintainers)
Top Results From Across the Web
GitHub Actions cache - Docker Documentation
The GitHub Actions cache utilizes the GitHub-provided Action's cache available from within your CI execution environment. This is the recommended cache to ...
Read more >whoan/docker-build-with-cache-action - GitHub
This action builds your docker image and caches the stages (supports multi-stage builds) to improve building times in subsequent builds.
Read more >Build images on GitHub Actions with Docker layer caching
Save hours of googling and learn how to build images on GitHub Actions with proper Docker layer caching. With Docker's BuildKit capabilities ...
Read more >How to use Docker layer caching in GitHub Actions - Depot
In this post, we are going to focus on how to build a Docker image as quickly as possible in GitHub Actions by...
Read more >Caching Docker builds in GitHub Actions: Which approach is ...
Once an image is created, we can use docker save to export the image to a tarball and cache it with actions/cache ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Now, we can pull a docker image from the Docker Hub or the GitHub Package Registry to skip a build step. But it is better the actions runner can cache a docker image with a built-in cache feature, not this cache action.
We are discussing at #37 that is focusing the Docker CLI, not a Docker action. We want to run a docker action with
uses:
key and cache it like the actions beta v1.We can skip a docker action build step like the following as a current workaround:
(Edit: Now, this action migrated to a TypeScript Action) GitHub Actions for GitHub Pages
Although, we cannot verify those images are trusted. I hope that we can build a docker action and cache it on the GitHub Actions runner.
I’ve tried using the docker save/load strategy but it does not work when the Dockerfile has a COPY/ADD command because the SHA produced is always different, I’m not sure why that happens, I’ve tried both with Github managed runners and self-hosted. Self-hosted works if I don’t run
docker system prune
which makes sense I think.