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"]
Este exercício faz parte do curso
Intermediate Docker
Exercício interativo prático
Transforme a teoria em ação com um de nossos exercícios interativos
