Understanding multi-stage builds
After successfully creating a multi-stage build, you want to make sure you understand the steps involved when actually running the docker build command.
Use the Dockerfile from the multi-stage build to follow the instructions below.
FROM golang:1.21 as gobuild
WORKDIR /src
COPY src/main.go /src/main.go
# Build the go application from source code
RUN go build -o /bin/app_runner /src/main.go
FROM scratch
COPY --from=gobuild /bin/app_runner /bin/app_runner
CMD ["/bin/app_runner"]
Diese Übung ist Teil des Kurses
Intermediate Docker
Interaktive Übung
In dieser interaktiven Übung kannst du die Theorie in die Praxis umsetzen.
Übung starten