Monk CIMonk CI

40x Faster Docker Builds

A persistent Docker layer cache co-located with your runners. Unchanged layers are restored from local NVMe instead of rebuilt - no registry, no cache-from/cache-to, no 10 GB cap.

Docker layer caching on Monk CI runs on the same runners that execute your workflow. Layers are persisted across runs on local NVMe storage, co-located with your build VM. On the next build, unchanged layers are restored from cache instantly and only the layers your commit actually changed are rebuilt.

There's no external registry to configure, no cache-from / cache-to flags to maintain, and no 10 GB cache cap.

Getting Started

Enabling the Docker cache is a two-line change. Swap the standard Buildx setup for Monk CI's builder, and drop the registry/GHA cache flags - they're no longer needed.

- name: Set up Docker Buildx
  uses: docker/setup-buildx-action@v3
  uses: MonkCi-Inc/setup-docker-builder@v1

- name: Build and push
  uses: docker/build-push-action@v6
  uses: MonkCi-Inc/build-push-action@v1
  with:
    context: .
    push: true
    tags: ghcr.io/your-org/app:latest
    cache-from: type=gha
    cache-to: type=gha,mode=max

MonkCi-Inc/setup-docker-builder provisions a Buildx builder wired into Monk CI's persistent cache layer, and MonkCi-Inc/build-push-action is what reads from and writes to that cache. Both steps are required - swapping only the builder setup, or building with docker/build-push-action or a plain docker build, won't hit the cache.

Run this on a Monk CI runner (e.g. runs-on: monkci-ubuntu-latest). The cache is co-located with the runner, so the builder must execute on Monk CI infrastructure to benefit from it.

Full Workflow Example

# .github/workflows/docker.yml
name: Build Image
on:
  push:
    branches: [main]

jobs:
  docker:
    runs-on: monkci-ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Set up Docker Builder
        uses: MonkCi-Inc/setup-docker-builder@v1

      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v3
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Build and push image
        uses: MonkCi-Inc/build-push-action@v1
        with:
          context: .
          push: true
          tags: ghcr.io/your-org/app:latest

How It Works

Per-repository cache - Monk CI keeps a separate layer cache for each repository, so builds for different repositories don't evict each other's layers.

Co-located on NVMe - The cache lives on fast local storage next to the build VM. Restoring a layer is a local disk read, not a network pull from a remote registry.

Incremental rebuilds - On each run, BuildKit reuses every layer up to the first one your commit changed. Stable layers - base images, system packages, dependency installs - are restored instantly.

Automatic eviction - Caches that go unused are reclaimed automatically.

What to Expect

The biggest wins come from Dockerfiles with heavy dependency installation - npm install, pip install -r requirements.txt, cargo build. When those layers don't change between commits (and they usually don't), they're restored in seconds instead of rebuilt from scratch.

Order your Dockerfile so dependency installs come before your application code to maximize cache hits. Cached builds typically run 10x to 40x faster than cold builds; the exact speedup depends on how much of your Dockerfile changes per commit.

Pricing

Add-on Pricing - $0.50 / GB-month

Docker layer caching is billed as an add-on, based on the storage your cache occupies - $0.50 per GB of cache per month. For details on overall platform pricing, visit the Pricing page.