As someone who spent way too much time chasing this rabbit, the real answer is Just Don't. GitHub Actions is a CI system that makes it easy to get started with simple CI needs but runs into hard problems as soon as you have more advanced needs. Docker caching is one of those advanced needs. If you have non-trivial Docker builds then you simply need on-disk local caching, period. Either use Depot or switch to self-hos…
Cache is King: A guide for Docker layer caching in GitHub Actions
41–50 of 111 posts
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#42I've spent days trying all of these solution at my company. All of these solutions suck, they are slow and only successful builds get their layers cached. This is a dead end. The only workable solution is to have a self-hosted runner with a big disk.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#43Earlier quoted context omitted.
The fact that GitHub don't provide a better solution here has to be actually costing them money with the network usage and extra agent time consumed. Right?
GitHub has perverse incentives to not fix this problem because they charge customers based on usage (by the minute), so they make more money by providing slower builds to end-users.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#44Use tools like Bazel + rules_oci or Gradle + jib and never spend time thinking about image builds taking time at all.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#45As someone who spent way too much time chasing this rabbit, the real answer is Just Don't. GitHub Actions is a CI system that makes it easy to get started with simple CI needs but runs into hard problems as soon as you have more advanced needs. Docker caching is one of those advanced needs. If you have non-trivial Docker builds then you simply need on-disk local caching, period. Either use Depot or switch to self-hos…
If there's one thing I've learned over the years, is that we really seldom have advanced needs. Mostly we just want things to work a certain way, and will fight systems to make it behave so. It's easier to just leave it be. Like maven vs gradle; yes, gradle can do everything, but if you need that it's worth taking a step back and assess why the normal maven flow won't work. What's so special with our app compared to the millions working just fine out of the box?
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#46I weep for this period of time where we don't have sticky disks readily available for builds. Uploading the layer cache each time is such a coarse and time-consuming way to cache things. Maybe building from scratch all the time is a good correctness decision? Maybe stale values in disks is a tricky enough issue to want to avoid entirely? If you keep a stack of disks around and grab a free one when the job starts you'…
We came to the same conclusion and built Depot around this exact workflow for the Docker image build problem. We're now bringing that same tech into GitHub Actions workflows.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#47this is pretty neat—it’s been a while since i’ve tried caching layers with gha. it used to be quite frustrating. my previous experience was that in nearly all situations the time spent sending and retrieving cache layers over the network wound up making a shorter build step moot. ultimately we said “fuck it” and focused on making builds faster without (docker layer) caching.
The registry cache idea is a neat idea, but in practice suffers the same problem.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#48CircleCI has an implementation that used to use a detachable disk, but that had issues with concurrency
It’s since been replaced with an approach that uses a docker plugin under the hood to store layers in object storage
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#49Earlier quoted context omitted.
Selh-hosted runners can be ephemeral too. With such either mount the cache as a disk or bake docker layers/images into the runner image.
This requires a lot of work from a dev inf team, though. Not as straightforward for an average team.
Setup GitHub app. Install the arc helm charts. Install a buildkitd statefulset.
Update parans on build to use buildkitd.
That's not to say there aren't better caching strategies, but a really basic ephemeral setup is right there.
Re: Cache is King: A guide for Docker layer caching in GitHub Actions
#50Docker layer caching is one of the reasons I moved to Jenkins 2 years ago and have been very happy with it for the most part. I only need to install utils once and all build time goes to building my software. It even integrates nicely with Github. Result: 50% faster feedback. However, it needs a bit initial housekeeping and discipline to use correctly. For example using Jenkinsfiles is a must and using containers as…
do you self host your jenkins deployment in your AWS account?