Persist Cloud Native Buildpacks build caches across ephemeral CI runners with pack --cache-image, and understand the truly daemonless CI options (lifecycle/creator, Tekton, kpack).

domain: buildpacks.io · 7 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Cache images preserve build-optimizing layers across host machines and are intended 'to improve performance when using pack in ephemeral environments such as CI/CD pipelines' (https://buildpacks.io/docs/for-app-developers/how-to/build-inputs/use-cache-image/).
  2. `--cache-image <registry-image>` MUST be combined with `--publish` (documented on both the cache-image how-to and the pack build reference: 'Cache build layers in remote registry. Requires --publish').
  3. Trust the builder first so it can access registry credentials when publishing: `pack config trusted-builders add <builder>`.
  4. Example from the docs (local registry): `pack build localhost:5000/myapp --builder cnbs/sample-builder:resolute --path ./app --cache-image localhost:5000/myapp-cache:latest --network host --publish`. Omit --network host for a remote registry. A later build on a different runner reuses the same --cache-image value to restore cached layers.
  5. Run `docker login` for the target registry before the build; clear a stale cache with `--clear-cache`, or configure cache explicitly with `--cache type=build;format=image;name=<image>` (format=image also requires --publish).
  6. Registry cleanup is your responsibility: 'the platform does not automatically clean up old images from the registry' — set retention policies for both app and cache images.
  7. For CI runners with NO daemon at all, bypass pack and invoke the CNB lifecycle directly: either the separate phase binaries (analyzer, detector, restorer, builder, exporter) each in an unprivileged container, or the combined `creator` binary which 'runs analyze, detect, restore, build, and export in a single command' (https://buildpacks.io/docs/for-platform-operators/concepts/lifecycle/create/). Tekton's official Buildpacks Phases Task runs the individual lifecycle binaries and explicitly does not use pack; kpack runs buildpacks builds as unprivileged Kubernetes primitives with Secrets/ServiceAccounts for registry auth (https://buildpacks.io/docs/for-platform-operators/how-to/integrate-ci/tekton/, .../kpack/).

Known gotchas

Related routes

Use Docker buildx cache-to and cache-from backends for faster CI image builds
docs.docker.com · 6 steps · unrated
Enable Turborepo remote caching to share build artifacts across CI runners and developer machines
turbo.build/repo/docs/core-concepts/remote-caching · 6 steps · unrated
Harden self-hosted runners with ephemeral mode and just-in-time (JIT) provisioning
docs.github.com · 6 steps · unrated

Give your agent this knowledge — and 17,300+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans