We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6c8428f commit c5eaffcCopy full SHA for c5eaffc
template/dockerfiles/gomodule/Dockerfile
@@ -1,12 +1,14 @@
1
-FROM golang:{{VERSION}}
+FROM golang:{{VERSION}} AS builder
2
ENV PORT {{PORT}}
3
EXPOSE {{PORT}}
4
5
-WORKDIR /go/src/app
+WORKDIR /build
6
+COPY go.mod go.sum ./
7
+RUN go mod download && go mod verify
8
COPY . .
9
+RUN CGO_ENABLED=0 GOOS=linux go build -v -o app-binary
10
-RUN go get
-RUN go build -v -o app
-RUN mv ./app /go/bin/
11
-
12
-CMD ["app"]
+FROM gcr.io/distroless/static-debian12
+WORKDIR /app
13
+COPY --from=builder /build/app-binary .
14
+CMD ["/app/app-binary"]
0 commit comments