B. Blue Green a software delivery tutorial
Vol. I § Zero-downtime series § A series for junior developers
Zero-downtime delivery · 3 / 10 ·

Dockerfile.base and Dockerfile.app

Every release should not re-download the entire Node.js universe. Two Docker files split what rarely changes from what changes often: Dockerfile.base installs the runtime, Dockerfile.app copies the titikterang code on top of that image.

Dockerfile.app · titikterang:v1.2.4-devDockerfile.base · runtime & tools
Dockerfile.base underneath, Dockerfile.app on top.

Build order

Build the base first, tag it, then build the app from that base. The lab CI does both before it pushes to the registry.

Sketch:

# Dockerfile.app
FROM registry.titikterang.local:5000/titikterang-base:1
COPY . /app
CMD ["node", "server.js"]

The base layers are reused. Only the app layer changes when you release v1.2.4-dev. The difference is not cosmetic — without this split, every deploy re-downloads every dependency from scratch.

Quick recap

  • Base image for the runtime, app image for code; build the base rarely, the app often.
  • Layers that change often go last so the cache survives.
  • A .dockerignore is mandatory, not optional — it prevents bloat and secret leaks in one move.

Reader notes

Chapter discussion appears once Giscus is connected to the site repository.