From c41bdc645da9c6aae1f1095a3d223a1e9fc91c24 Mon Sep 17 00:00:00 2001 From: Alexey Date: Mon, 8 Apr 2024 21:33:54 +0300 Subject: [PATCH] multi-stage building Reduced the weight of the container with the broker by 10 times using multi-stage assembly --- Dockerfile | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index aa71f1e..642ece4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,20 @@ -FROM golang:alpine +FROM golang:1.22 as builder WORKDIR /app - COPY . . -RUN go mod download +ENV CGO_ENABLED 0 +ENV GOOS linux + +RUN go mod download RUN go build -o limero ./cmd/limero/main.go -EXPOSE 7920 -ENTRYPOINT [ "/app/limero" ] +FROM alpine:3.19 + +WORKDIR /app +COPY --from=builder /app/limero . +EXPOSE 7920 +ENTRYPOINT [ "/app/limero" ] \ No newline at end of file