Reduce Layers
Each RUN, COPY, and ADD instruction adds a new layer to your image. Combining commands helps reduce the number of layers and the overall image size.
Inefficient:
RUN apt-get update
RUN apt-get install -y python
RUN apt-get install -y pip
Efficient:
RUN apt-get update && apt-get install -y \
python \
pip \
&& rm -rf /var/lib/apt/lists/*12
