Containers: Docker, Compose and Swarm

Intermediate

The build cache

Every one-line change to the orders API costs four minutes of npm ci in CI. Reorder the Dockerfile so that a code change rebuilds in under 20 seconds.

The test builds your image once, changes a line in src/routes.js, builds again and measures that second build. Then it runs the image and calls /health. Try it in the terminal: build, edit routes.js, build again.

What your server must hold

  • Rebuild after a code change < 20 s
  • Availability ≥ 99 %

What you will master