1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-05-31 21:59:42 +02:00
Niek den Breeje 01b7b4409b
Fix generating Dockerfile with Gomu (#2254)
Somehow I didn't test this and managed to forget to properly close a
template control structure. This change fixes that.
2021-09-08 14:43:52 +01:00

26 lines
765 B
Go

package template
// Dockerfile is the Dockerfile template used for new projects.
var Dockerfile = `FROM golang:alpine AS builder
ENV CGO_ENABLED=0 GOOS=linux
WORKDIR /go/src/{{.Alias}}
RUN apk --update --no-cache add ca-certificates gcc libtool make musl-dev protoc
COPY {{if not .Client}}Makefile {{end}}go.mod go.sum ./
RUN {{if not .Client}}make init && {{end}}go mod download
COPY . .
RUN make {{if not .Client}}proto {{end}}tidy build
FROM scratch
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
COPY --from=builder /go/src/{{.Alias}}/{{.Alias}} /{{.Alias}}
ENTRYPOINT ["/{{.Alias}}"]
CMD []
`
// DockerIgnore is the .dockerignore template used for new projects.
var DockerIgnore = `.gitignore
Dockerfile{{if .Skaffold}}
resources/
skaffold.yaml{{end}}
`