News for hackers. Stuff that matters.
Re:Rails on Docker · Fly by korijn on Thursday January 26, 2023 @03:03PM (#34537929)
You can build the first stage separately as a first step using `--target` and store the cache that way. No problem.
Re:Rails on Docker · Fly by orf on Thursday January 26, 2023 @06:21PM (#34540273)
How would you do this in a generic, reusable way company-wide for any Dockerfile? Given that you don't know the targets beforehand, the names, or even the number of stages.

It is of course possible to do for a single project with a bit of effort: build each stage with a remote OCI cache source, push the cash there after. But... that sucks.

What you want is the `max` cache type in buildkit[1]. Except... not much supports that yet. The native S3 cache would also be good once it stabalizes.

1. https://github.com/moby/buildkit#export-cache

Re:Rails on Docker · Fly by korijn on Friday January 27, 2023 @02:57AM (#34543708)
Standardize the stages and names. We use `dev` and `latest`.

It worked wonders for us, on a cache hit the build time is reduced from 10 to 1,5 minutes.