2018-04-10 11:15:41 +00:00
|
|
|
FROM golang:alpine as builder
|
|
|
|
|
2018-09-20 14:28:08 +00:00
|
|
|
COPY . /go/src/{{ .package }}
|
2018-04-10 11:15:41 +00:00
|
|
|
WORKDIR /go/src/{{ .package }}
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
&& apk add --update git \
|
2018-04-10 12:16:42 +00:00
|
|
|
&& go install -ldflags "-X main.version=$(git describe --tags || git rev-parse --short HEAD || echo dev)"
|
2018-04-10 11:15:41 +00:00
|
|
|
|
|
|
|
FROM alpine:latest
|
|
|
|
|
|
|
|
LABEL maintainer "{{ .git_name }} <{{ .git_mail }}>"
|
|
|
|
|
|
|
|
RUN set -ex \
|
|
|
|
{{ if ne .timezone "" -}}
|
|
|
|
&& apk --no-cache add tzdata \
|
|
|
|
&& cp /usr/share/zoneinfo/{{ .timezone }} /etc/localtime \
|
|
|
|
&& echo "{{ .timezone }}" > /etc/timezone \
|
|
|
|
&& apk --no-cache del --purge tzdata \
|
|
|
|
{{- end -}}
|
|
|
|
&& apk --no-cache add ca-certificates
|
|
|
|
|
|
|
|
COPY --from=builder /go/bin/{{ .binary }} /usr/local/bin/{{ .binary }}
|
|
|
|
|
|
|
|
{{ if .expose }}EXPOSE{{ range .expose }} {{.}}{{ end }}{{end}}
|
|
|
|
{{ if ne .volumes `""` }}VOLUME [{{ .volumes }}]{{ end }}
|
|
|
|
|
|
|
|
ENTRYPOINT ["/usr/local/bin/{{ .binary }}"]
|
|
|
|
CMD ["--"]
|
|
|
|
|
|
|
|
# vim: set ft=Dockerfile:
|