From 0018b5d8c61b8c8269aaab28d9f85c73013e5e9f Mon Sep 17 00:00:00 2001 From: Denozordec Date: Fri, 20 Mar 2026 18:59:32 +0700 Subject: [PATCH] Update Dockerfile to copy both go.mod and go.sum, and combine go mod download and build commands into a single RUN statement for improved efficiency. --- Dockerfile | 5 ++--- go.sum | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 go.sum diff --git a/Dockerfile b/Dockerfile index 25652a9..06da599 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,9 @@ FROM golang:1.22-alpine AS builder WORKDIR /src -COPY go.mod ./ +COPY go.mod go.sum ./ COPY main.go ./ -RUN go mod download -RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /out/telemt-bot . +RUN go mod download && CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -ldflags="-s -w" -o /out/telemt-bot . FROM gcr.io/distroless/static-debian12:nonroot WORKDIR /app diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e890837 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=