cache icon indicating copy to clipboard operation
cache copied to clipboard

Caching build of Docker actions

Open ad-m opened this issue 6 years ago • 12 comments

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

ad-m avatar Oct 31 '19 15:10 ad-m

See ad-m/github-push-action#19 too.

ad-m avatar Oct 31 '19 15:10 ad-m

@joshmgross commented 5 minutes ago:

@ad-m I think it's fine to leave that in @actions/toolkit, as it's a general improvement to Docker actions. If the recommended step is to just cache before using every docker action, then that might be better if done by default.

ad-m avatar Oct 31 '19 20:10 ad-m

Azure has recently released Teleport for images from Azure Container Registry ( https://stevelasker.blog/2019/10/29/azure-container-registry-teleportation/ ). The concept based on the use of SMB, which allows you to read only the necessary parts of layers without full transfer is very interesting, because it can give a very quick start in this use case. However, I suppose the Azure permissions model may still be too limited to direct integration, despite recent development of Azure in that area.

ad-m avatar Nov 01 '19 22:11 ad-m

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.

peaceiris avatar Nov 12 '19 00:11 peaceiris

Any news?

bhack avatar Apr 13 '20 16:04 bhack

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.

emersonreisdev avatar Apr 18 '20 07:04 emersonreisdev

+1

jimgreer avatar May 03 '20 22:05 jimgreer

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] avatar Jul 24 '23 08:07 github-actions[bot]

I see this issue is stale and in danger of being closed. I think this is a much needed feature that needs to be added.

markbaird avatar Jul 24 '23 18:07 markbaird

This issue is stale because it has been open for 200 days with no activity. Leave a comment to avoid closing this issue in 5 days.

github-actions[bot] avatar Feb 11 '24 08:02 github-actions[bot]

Still relevant.

gshpychka avatar Feb 12 '24 10:02 gshpychka