From 6b2732c943826df99b0f79d4189b2c7cf70f41ff Mon Sep 17 00:00:00 2001 From: Aune <31650531+aunefyren@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:44:10 +0100 Subject: [PATCH] Shrunk Docker image by using a builder (#87) --- Dockerfile | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index beeb7de..0ccb340 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,22 @@ -FROM golang:1.20.3-bullseye +FROM golang:1.20.4-bullseye as builder -ARG TARGETARCH -ARG TARGETOS +ARG TARGETARCH +ARG TARGETOS ENV port=8282 -LABEL org.opencontainers.image.source=https://github.com/aunefyren/wrapperr - WORKDIR /app COPY . . -RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build +RUN GO111MODULE=on CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} go build + +FROM debian:bullseye-slim as runtime + +LABEL org.opencontainers.image.source=https://github.com/aunefyren/wrapperr + +WORKDIR /app + +COPY --from=builder /app . EXPOSE ${port}