Image Build Optimization
Goal to optimize a Dockerfile
Faster build
Smaller image
More secure contents
Easier to maintain
Overview
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
–
More
BuildKit RUN mount
Base and derived images
LABEL
Job dependencies
CI caching
CI only certain file changes
Remote tagging
Readability beats size