From 10e434f7c3263780a0a448b69308714de07b2973 Mon Sep 17 00:00:00 2001 From: vijeyash Date: Fri, 15 Sep 2023 10:17:50 +0530 Subject: [PATCH] minor fix --- dockerfiles/migration/Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dockerfiles/migration/Dockerfile b/dockerfiles/migration/Dockerfile index dbd4949e..6de44b79 100644 --- a/dockerfiles/migration/Dockerfile +++ b/dockerfiles/migration/Dockerfile @@ -20,3 +20,26 @@ RUN chmod +x /script/wait-for-clickhouse.sh USER 65532:65532 ENTRYPOINT ["/migration"] + + +FROM golang:1.20 as builder + +WORKDIR /workspace +COPY ./ ./ +RUN go mod download + +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o migration cmd/cli/main.go + +RUN chmod +x /workspace/script/wait-for-clickhouse.sh + +# Use distroless as minimal base image to package the manager binary +# Refer to https://github.com/GoogleContainerTools/distroless for more details +FROM gcr.io/distroless/static:nonroot +WORKDIR / +COPY --from=builder /workspace/migration . +COPY --from=builder /workspace/sql /sql +COPY --from=builder /workspace/script /script + +USER 65532:65532 + +ENTRYPOINT ["/migration"]