Table of Contents

Optimization

ordering

Put frequently changed commands at end

apt

RUN apt-get install -y --no-install-recommends &&
unzip \
wget && \
rm -rf /var/lib/apt-lists/* && \
apt-get purge --auto-remove && \
apt-get clean

multistage

Use intermediate container to build some artifact and copy only ready artifact to final image.