5
Docker multi-stage technology
source link: https://linuxsuren.github.io/blog/devops/docker/multi-stage/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Docker multi-stage technology
Docker multi-stage technology
We can build our application in Dockerfile. But we don’t want the whole thing in our final docker image. Docker multi-stage technology could help us the reduce the size.
FROM golang:1.12 AS builder
WORKDIR /work
RUN git clone https://github.com/devops-ws/learn-pipeline-go && \
cd learn-pipeline-go && go build -o go-server
RUN ls -hal
FROM alpine:3.10
COPY --from=builder /work/learn-pipeline-go/go-server .
CMD ['go-server']
After built this: docker build . -t go-server
then we can test it: docker run go-server
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK