summaryrefslogtreecommitdiff
path: root/Dockerfile
blob: 3d8d97b9bb40f9e418df960b83fb6797513c9e46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM golang:1.8-alpine AS build

RUN mkdir -p /go/src/github.com/hairyhenderson/gomplate
WORKDIR /go/src/github.com/hairyhenderson/gomplate
COPY . /go/src/github.com/hairyhenderson/gomplate

RUN apk add --no-cache \
    make \
    git

RUN make build

FROM debian:jessie AS compress

RUN apt-get update -qq
RUN DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -yq curl xz-utils ca-certificates
RUN curl -fsSL -o /tmp/upx.tar.xz https://github.com/upx/upx/releases/download/v3.94/upx-3.94-amd64_linux.tar.xz \
  && tar Jxv -C /tmp --strip-components=1 -f /tmp/upx.tar.xz

COPY --from=build /go/src/github.com/hairyhenderson/gomplate/bin/gomplate /gomplate
RUN /tmp/upx --lzma /gomplate -o /gomplate-slim

FROM alpine:3.6 AS gomplate

ARG BUILD_DATE
ARG VCS_REF

LABEL org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.vcs-ref=$VCS_REF \
      org.label-schema.vcs-url="https://github.com/hairyhenderson/gomplate"

COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 
COPY --from=build /go/src/github.com/hairyhenderson/gomplate/bin/gomplate /gomplate

ENTRYPOINT [ "/gomplate" ]

CMD [ "--help" ]

FROM alpine:3.6 AS gomplate-slim

ARG BUILD_DATE
ARG VCS_REF

LABEL org.label-schema.build-date=$BUILD_DATE \
      org.label-schema.vcs-ref=$VCS_REF \
      org.label-schema.vcs-url="https://github.com/hairyhenderson/gomplate"

COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt 
COPY --from=compress /gomplate-slim /gomplate

ENTRYPOINT [ "/gomplate" ]

CMD [ "--help" ]