go-server.Dockerfile.mustache Maven / Gradle / Ivy
FROM golang:1.19 AS build
WORKDIR /go/src
COPY {{sourceFolder}} ./{{sourceFolder}}
COPY main.go .
COPY go.sum .
COPY go.mod .
ENV CGO_ENABLED=0
RUN go build -o {{packageName}} .
FROM scratch AS runtime
COPY --from=build /go/src/{{packageName}} ./
EXPOSE 8080/tcp
ENTRYPOINT ["./{{packageName}}"]