Chapter 4. Dependency Mirrors
Pre-reqs
- Docker Desktop (macOS/Windows) or Docker Engine (Linux)
- Your repo root with
infra/docker/dep-mirror.yaml
Steps
Start the mirrors
make dep-mirror-up- Go proxy at
http://localhost:8081 - (Optional) Verdaccio (npm) at
http://localhost:4873
- Go proxy at
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
Build as usual (downloads now pass via the mirror)
make build
Verify
For Go:
curl -fsS http://localhost:8081/healthzConfirm 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
GOPROXYin 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)