Goal to optimize a Dockerfile

Goal to optimize a Dockerfile

Faster build

Smaller image

More secure contents

Easier to maintain


Multi-stage build FROM scratch Order of commands BuildKit RUN cache Heredocs USER Parallel multi-stage build Dependency update, e.g. RenovateBot Patch/digest auto-merge Automated build Cache From Testing Scan Scheduled rebuild


BuildKit RUN mount

Base and derived images


Job dependencies

CI caching

CI only certain file changes

Remote tagging

Readability beats size