Build once, deploy everywhere

An image is built once, by the CI, and that very image goes to every environment and every server. Servers pull it; they never build it.

How it works

The pipeline builds and tests one image, pushes it under a version, and the Compose file of each environment names that version with image:. What differs between environments comes from variables and files at run time, not from a new build.

What breaks

Building on the server (docker compose up --build in production) needs the source code and the build tools there, takes CPU from the live service, and can produce another image than the one tested: a dependency range resolved differently, a newer base image. Keep build: for development and CI; production files use image:.

In compose.yaml

services:
  api:
    image: registry.shop.internal/shop/api:1.4.0
  worker:
    image: registry.shop.internal/shop/worker:1.4.0

See it break, then fix it

Write the Dockerfile or the compose file, type the docker commands, and watch a simulated server run them through reboots, upgrades and traffic. Free to start.