Ship the Tool, Not the Toolchain
Convert a bloated single-stage build to multi-stage.
A advanced Docker challenge worth 20 points. Solve it hands-on in a real Docker environment in your browser - no local setup, no fake shells.
The Challenge
Scenario: tool:v1 works, but ships its whole 30MB build toolchain for an app that is one shell script.
Tasks: rewrite /root/tool/Dockerfile as a multi-stage build:
- stage 1 (
FROM alpine:3.20 AS build): toolchain + "compile", exactly like today - stage 2 (
FROM alpine:3.20):COPY --from=buildonly/usr/local/bin/app - Build as
tool:v2: same behavior (docker run --rm tool:v2 app→tool ok), ≥25MB smaller, no/opt/toolchain.bininside
Commands to learn: multi-stage FROM … AS, COPY --from
Run check when done.