Closed jakeleventhal closed 8 months ago
Hi Jake, could you elaborate a little bit more on what you mean by having Turborepo cache docker images? Docker itself already has fairly advanced image caching.
sure, what im referring to is being able to cache the output of a docker build much in the same way that i would cache any other output in turbo. For instance, i should be able to run a script "image" via turbo image
which builds a docker image, and specify the image as an output (similar to how bazel works). then in ci, my remote cache should be able to recognize a cache hit, and download the docker artifact as an output
@jakeleventhal what happens when you do that today? I imagine the artifact size is pretty large, so writing to cache (especially remote cache) could take a while, but turbo shouldn't have an opinion over what the outputs are. If you're running into issues, can you provide a reproduction repo?
how exactly would you even specify a docker image output?
sorry, it's been ~a decade since I used docker, does it not create the image on your local disk first? Is it no longer a local directory or file on your filesystem when you create the image?
They get saved to a ~/.docker directory
Is it possible to customize that location such that you could put it in the repo location? (I assume that even if that is possible it may interfere with other docker operations). That said, it seems like there are a couple general purpose features here:
outputs
outside the repo root (which is already possible, I think)--cache-dir
per task, so in your case the image
task could specify the locationWill bring this up with the team!
There isn't a way to specify this unfortunately.
Which project is this feature idea for?
Turborepo
Describe the feature you'd like to request
Turbo should be able to cache docker images and use those with cache hits.
Describe the solution you'd like
Implement caching with docker images.
Describe alternatives you've considered
N/A