Chapter 4. Dependency Mirrors

Pre-reqs

  • Docker Desktop (macOS/Windows) or Docker Engine (Linux)
  • Your repo root with infra/docker/dep-mirror.yaml

Steps

  1. Start the mirrors

    make dep-mirror-up
    
    • Go proxy at http://localhost:8081
    • (Optional) Verdaccio (npm) at http://localhost:4873
  2. Point the project at the mirror

    • Go:

      export GOPROXY=http://localhost:8081,direct
      go clean -modcache && (cd app && go mod download)
      
    • npm (optional): add a project .npmrc

      registry=http://localhost:4873/
  3. Build as usual (downloads now pass via the mirror)

    make build
    

Verify

  • For Go:

    curl -fsS http://localhost:8081/healthz
    
  • Confirm a fresh dependency fetch is fast (served from cache) and your app builds.

Makefile commands

  • Start/stop: make dep-mirror-up / make dep-mirror-down
  • CI tip: set GOPROXY in your pipeline env so builds are deterministic.

Checklist

  • Mirror started (dep-mirror-up)
  • Project points to mirror (GOPROXY=... or .npmrc)
  • Build succeeds with mirror in place
  • Evidence captured (document GOPROXY in your runbook)