Skip to content
Opsfolk

Building images, topic 21 of 41

Multi-stage builds

A multi-stage Dockerfile has several FROM lines. An early stage has the compilers and dev dependencies and builds the application; the final stage starts from a small base and copies in only what runs, with COPY --from=build.

The image you ship then has no build tools, source or caches: it is smaller, quicker to pull, and has less in it for an attacker to use.

On Opsfolk

Nothing of ours for this topic yet: an article is on its way.

Elsewhere

Your progress