From d2f7f263857c3d058ea972930b8f7d8ba5309086 Mon Sep 17 00:00:00 2001 From: yasindumalmith Date: Tue, 4 Nov 2025 19:29:07 +0530 Subject: [PATCH 1/2] Write Docker file with multi stage --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..56abe1e57 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.21 as base +WORKDIR /app +COPY go.mod . +RUN go mod download +COPY . . +RUN go build -o main . + +#Final Stage + +FROM gcr.io/distroless/base +COPY --from=base /app/main . +COPY --from=base /app/static ./static +EXPOSE 8080 +CMD ["./main"] From f447bafd81625ce24c1b2c4fa7d247543eb94362 Mon Sep 17 00:00:00 2001 From: yasindumalmith Date: Tue, 4 Nov 2025 19:49:06 +0530 Subject: [PATCH 2/2] Write Docker file with multi stage --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 56abe1e57..c62f2b346 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.21 as base +FROM golang:1.22 as base WORKDIR /app COPY go.mod . RUN go mod download