question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Caching build of Docker actions

See original GitHub issue

Describe 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:open
  • Created 4 years ago
  • Reactions:62
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
peaceiriscommented, Jul 28, 2020

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:

- uses: peaceiris/actions-gh-pages@v2
+ uses: docker://peaceiris/gh-pages:v2

(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.

1reaction
dungahkcommented, Apr 18, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found