How BuildKit Cache Dance works
mainBuildKit Cache Dance solves the problem of losing RUN --mount=type=cache data between CI runs (like GitHub Actions). Since these cache mounts are local to the BuildKit builder and not automatically persisted by CI providers, this tool allows you to:
- Extract: After a build, extract the contents of the cache mounts from the container into a persistent directory (e.g., using
actions/cache). - Inject: Before a new build, inject the contents of that persistent directory back into the BuildKit builder's cache mounts.
This enables persistent caches for tools like apt-get, go-build, and others across different CI jobs.