use a multistage Docker build

This significantly reduces the file size of the resulting Docker image.
This commit is contained in:
Marten Seemann
2019-10-23 11:04:04 +07:00
parent f6d963c991
commit 9983c7903d
2 changed files with 15 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
FROM martenseemann/quic-network-simulator-endpoint:latest
FROM martenseemann/quic-network-simulator-endpoint:latest AS builder
RUN apt-get update && apt-get install -y wget tar git vim python
RUN apt-get update && apt-get install -y wget tar git
RUN wget https://dl.google.com/go/go1.13.3.linux-amd64.tar.gz && \
tar xfz go1.13.3.linux-amd64.tar.gz && \
@@ -18,6 +18,17 @@ RUN git clone https://github.com/lucas-clemente/quic-go && \
WORKDIR /quic-go
RUN go build -o server interop/server/main.go && \
go build -o client interop/client/main.go
FROM martenseemann/quic-network-simulator-endpoint:latest
WORKDIR /quic-go
COPY --from=builder /quic-go/internal/testdata/cert.pem /quic-go/internal/testdata/priv.key internal/testdata/
COPY --from=builder /quic-go/server /quic-go/client ./
COPY run_endpoint.sh .
RUN chmod +x run_endpoint.sh