I'm using the new experimental docker buildkit syntax to do a multistage build, as so:
Dockerfile:
RUN --mount=type=cache,target=/home/build/.build-cache,gid=1000,uid=1001 ./build
bash:
DOCKER_BUILDKIT=1 docker build .
Works great locally. On CI I get a new docker environment every time, so no caching.
I can export and import files into the env, but I don't know where the cache is located. Any ideas?
Or should I be exporting/importing the cache via some docker command? I've read https://docs.docker.com/engine/reference/commandline/build/#specifying-external-cache-sources and https://github.com/moby/buildkit#export-cache but it's not clear to me which is buildkit specific, which docker specific or if either really applies to this cache mounted into the Dockerfile RUN command.
I have added a public gist here of a failing test demonstrating what I was hoping for: https://gist.github.com/Mahoney/85e8549892e0ae5bb86ce85339db1a71/6308f1bdb062a8982017193b96d61ec00a7698c5
And this later revision works, but I'm not happy with it - too much bootstrapping: https://gist.github.com/Mahoney/85e8549892e0ae5bb86ce85339db1a71