1 min read

Build once, promote forever

Why rebuilding an image per environment is how config leaks into binaries — and how promotion replaces it.

  • CI/CD
  • Docker

Every pipeline I've audited that "sometimes behaves differently in prod"
had the same root cause: the prod image was a different build than the
one that was tested.

Rebuilds reintroduce variance at the worst possible moment — after review,
during deploy. The fix is boring and total: build exactly once, tag it
with the commit SHA, and promote that immutable artifact through dev,
staging, prod. Environment differences live in env files and mounted
config, never in go build flags.

The culture shift is the hard part. Teams stop saying "rebuild it for
prod" and start saying "promote sha-a1b2c3d". Once that sentence feels
normal, rollbacks become deploy.sh prod sha-<last-good> — a two-second
operation you rehearse instead of fear.