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.
Publish telemt-bot Docker image / build-and-push (push) Successful in 55s
Publish telemt-bot Docker image / build-and-push (push) Successful in 55s
This commit is contained in:
+2
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user