feat: support scratch as the base docker image (#1634)

This commit is contained in:
Kevin Wan
2022-03-11 12:15:38 +08:00
committed by GitHub
parent d6a692971f
commit 26a33932cd
3 changed files with 12 additions and 5 deletions

View File

@@ -28,9 +28,9 @@ COPY . .
{{end}}RUN go build -ldflags="-s -w" -o /app/{{.ExeFile}} {{.GoRelPath}}/{{.GoFile}}
FROM alpine
FROM {{if .Scratch}}scratch{{else}}alpine{{end}}
RUN apk update --no-cache && apk add --no-cache ca-certificates
{{if .Scratch}}COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt{{else}}RUN apk update --no-cache && apk add --no-cache ca-certificates{{end}}
{{if .HasTimezone}}COPY --from=builder /usr/share/zoneinfo/{{.Timezone}} /usr/share/zoneinfo/{{.Timezone}}
ENV TZ {{.Timezone}}
{{end}}