Multi-stage builds: compile big, ship small
Select an icon to see what it is.
Step 2 of 6
The builder stage compiles the program
BuildKit runs the first stage: it copies the source in and runs go build in a temporary container. The compiler, the module cache and the source all live in this stage's layers. The result is a single file, /out/web.
BuildKit log, stage builder (illustrative numbers)
#4 [builder 3/4] COPY . .#5 [builder 4/4] RUN CGO_ENABLED=0 go build -o /out/web .