Monorepo for Tangled tangled.org

knot2: cache compiled crates across container builds #4758

Open mads.havmand.eu
targeting master from mads.havmand.eu/core:containerfile-compile-cache
Open opened by and assigned to mads.havmand.eu
targeting master from mads.havmand.eu/core:containerfile-compile-cache

The build step wrote to /src/target inside the image layer, so any source change recompiled the whole workspace from zero, including all dependencies.

Mount the target directory as a cache mount and copy the binaries to /out within the same step, since the contents of a mount are not part of the committed layer. The final stage then copies from /out.

With the cache mount, a source change only recompiles the crates that changed, and an interrupted build resumes instead of starting over. The syntax works with podman/buildah and with Docker's BuildKit builder.

Commits 1

knot2: cache compiled crates across container builds