From df8802c5aa92670bf7df228adfe6e050f899a989 Mon Sep 17 00:00:00 2001 From: kwall Date: Fri, 24 Nov 2023 15:20:00 +0000 Subject: [PATCH] multistage --- Dockerfile | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..159f696 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,26 @@ +FROM golang:1.18 as BuildStage + +# Set destination for COPY +WORKDIR /app + +# Download Go modules +COPY go.mod go.sum ./ +RUN go mod download +COPY . ./ +#RUN ls --recursive ./ + +# Build +RUN CGO_ENABLED=0 GOOS=linux go build -ldflags "-w -s" -o /kaf ./cmd/kaf +#RUN ls --recursive ./ +#RUN ls --recursive /kaf + +FROM registry.access.redhat.com/ubi9/ubi:9.3 + +WORKDIR / + +COPY --from=BuildStage /kaf /bin/kaf + +USER 1001 + +# Run +CMD ["/bin/kaf"]