Lesson 1.2

Layers, caching, and multi-stage builds

Instruction order decides your build time. Copy dependency manifests before source, and use a multi-stage build to leave the toolchain behind.

Taught byAlina CostaDocker · Kubernetes · CI/CD · Application security
7m Advanced 8,194 students

Overview

Instruction order decides your build time. Copy dependency manifests before source, and use a multi-stage build to leave the toolchain behind.

What this lesson covers

  • Order instructions so the cache survives code changes
  • Separate build and runtime with multi-stage builds
  • Cut image size and shrink the attack surface

This lesson sits in Containers and Images, part of DevOps with Docker and Kubernetes. It assumes what came before it and leads directly into the next lesson in the module.

In this lesson you will:

  • Order instructions so the cache survives code changes
  • Separate build and runtime with multi-stage builds
  • Cut image size and shrink the attack surface

Resources