2021-08-30 16:48:57 +02:00
|
|
|
package template
|
|
|
|
|
|
|
|
// Dockerfile is the Dockerfile template used for new projects.
|
|
|
|
var Dockerfile = `FROM golang:alpine AS builder
|
|
|
|
ENV CGO_ENABLED=0 GOOS=linux
|
2021-09-10 14:20:57 +02:00
|
|
|
WORKDIR /go/src/{{.Service}}{{if .Client}}-client{{end}}
|
2021-08-30 16:48:57 +02:00
|
|
|
RUN apk --update --no-cache add ca-certificates gcc libtool make musl-dev protoc
|
2021-09-08 15:43:52 +02:00
|
|
|
COPY {{if not .Client}}Makefile {{end}}go.mod go.sum ./
|
2021-09-08 13:50:30 +02:00
|
|
|
RUN {{if not .Client}}make init && {{end}}go mod download
|
|
|
|
COPY . .
|
|
|
|
RUN make {{if not .Client}}proto {{end}}tidy build
|
2021-08-30 16:48:57 +02:00
|
|
|
|
|
|
|
FROM scratch
|
|
|
|
COPY --from=builder /etc/ssl/certs /etc/ssl/certs
|
2021-09-10 14:20:57 +02:00
|
|
|
COPY --from=builder /go/src/{{.Service}}{{if .Client}}-client{{end}}/{{.Service}}{{if .Client}}-client{{end}} /{{.Service}}{{if .Client}}-client{{end}}
|
|
|
|
ENTRYPOINT ["/{{.Service}}{{if .Client}}-client{{end}}"]
|
2021-08-30 16:48:57 +02:00
|
|
|
CMD []
|
|
|
|
`
|
|
|
|
|
|
|
|
// DockerIgnore is the .dockerignore template used for new projects.
|
|
|
|
var DockerIgnore = `.gitignore
|
|
|
|
Dockerfile{{if .Skaffold}}
|
|
|
|
resources/
|
|
|
|
skaffold.yaml{{end}}
|
|
|
|
`
|