What is the problem or limitation you are having?
Currently, CI must completely rebuild several images every time it runs. These should be cached and downloaded when needed. This should work for non-main
branches as well as forks such that even a brand new fork will use a cached image.
Describe the solution you'd like
Like anything worth doing in Docker, this ain't easy.
Independent of the Docker image build process, you can't just say "take the current state, cache it, and let me restore it when I try to build again"...everything is a bit more tightly integrated. The is primarily because the "state" isn't just the tag assigned at the end; you can't just export that image for that tag, save it somewhere, re-import it later, and expect the docker build
command to know it doesn't need to redo everything. That image needs additional metadata and potentially even additional layers that wouldn't be normally included for docker build
to treat it more like a cache.
But even then, the docker build
command needs to be instructed to use it; therefore, the docker build
command from Briefcase will almost certainly need to be updated to support arbitrary additional options.
This Docker caching is facilitated via the --cache-to
and --cache-from
options.
Option 1: Inline Caching
The simplest way to accomplish this may be "inline" caching. When this is configured, Docker treats the output image as the place to cache. So, if you push an image to a registry built with inline caching and pull it later, your docker build
command can use it.
However, the Briefcase images aren't currently tagged in a way for them to be pushed to a registry....so, there will need to be this dance of associating another tag with the image and then pushing. Conversely, when they are pulled down, they'll need to be re-tagged again.
Option 2: Direct Registry Caching
Docker supports caching to and from a registry directly....however, they don't support this out of the box for a reason I haven't grasped yet. So, a custom builder needs to be created using the "docker-container" driver.
In this way, the --cache-to
and --cache-from
options simply need to set to an arbitrary registry image that Docker will treat as a cache.....it's actually pretty snazzy.....but I don't understand the potential consequences of creating and using such a builder with Briefcase yet.
Describe alternatives you've considered
No caching.
Additional context
This will serve as a knowledge dump for now....since I realized I won't be able to knock this out very quickly apparently...