Builds an image from a Dockerfile — each instruction becomes a cached layer, so unchanged steps stay fast on rebuild.
Order Dockerfile instructions from least- to most-often-changing (dependencies before source code) so a source change doesn't invalidate the dependency-install layer's cache.
Everything in the context folder is sent to the builder before the first step runs. A missing .dockerignore makes builds slow and can leak secrets into the image.
Never COPY .env files or keys into an image: anyone who can pull the image can read every layer. Pass secrets at runtime or use --secret.