cfg/.config/gen-dockerfile.tpl
Knut Ahlers f5902df81f
Simplify command
Thanks for pointing me to this @mlafeldt

Signed-off-by: Knut Ahlers <knut@ahlers.me>
2019-02-05 15:21:31 +01:00

31 lines
843 B
Smarty
Executable file

FROM golang:alpine as builder
COPY . /go/src/{{ .package }}
WORKDIR /go/src/{{ .package }}
RUN set -ex \
&& apk add --update git \
&& go install -ldflags "-X main.version=$(git describe --tags --always || echo dev)"
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: