From cf979580819779b22afe7b0163dd4e34caa1713f Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 9 Jun 2023 11:31:49 +0200 Subject: [PATCH] optimze the docker build --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 87173ca..90fe3e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,15 @@ FROM golang:1.19 as builder WORKDIR /src +COPY go.mod go.sum ./ +RUN go mod download + COPY . . -RUN go build +RUN CGO_ENABLED=0 GOOS=linux go build -o /app/capture FROM debian:stable-slim -RUN apt-get update && apt-get install ca-certificates -y -COPY --from=builder /src/capture /usr/bin/capture +RUN apt-get update && apt-get install -y ca-certificates +COPY --from=builder /app/capture /usr/bin/capture ENTRYPOINT ["/usr/bin/capture"]