Action's Docker image not being cached

I’ve recently created a Docker-based GitHub action: Org Knit · Actions · GitHub Marketplace · GitHub

The Docker image used takes around an hour to build (to a final size of 3.8 GB), but often runs completely in under a minute.

I expected that GitHub would cache the build image for performance reasons, however in the little test I’ve done there has been no sign of this (Actions · tecosaur/org-knit-action-test · GitHub).

Is caching actually performed? If so, is there something I need to do to enable it?

1 Like

There’s no caching: The action image is built in the runner that uses it, and for Github hosted runners the runner VM is discarded after the job is complete. As far as I’m aware the only way to avoid rebuilding the image all the time would be to push it to a public registry (e.g. GHCR) and use it from there. Though 3.8 GB is still a lot to pull.

Thanks for clarifying. I’ll probably add a workflow to upload the build to GHCR then.

3.8 GB is a fair bit, but in order to produce PDFs we need TeXlive for starters, and I’ve front-loaded a lot of potential installation time with popular packages into the image. I might be able to trim this down to 2.5 GB in the future, but there’s no way this image will become slim :sweat_smile:.

1 Like