Dockerfile 729 Bytes
Newer Older
1
FROM golang:1.13-alpine as buildenv
2
3
4
5
6
7

RUN apk add --no-cache git

RUN mkdir -p /dist/empty
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.1/dumb-init_1.2.1_amd64 /dist/dumb-init
RUN chmod 755 /dist/dumb-init
Arie Peterson's avatar
Arie Peterson committed
8

9
WORKDIR /go/src/ghost
10

Arie Peterson's avatar
Arie Peterson committed
11
COPY go.mod go.sum ./
12
13
RUN go mod download

14
15
16
COPY cmd ./cmd
COPY ghost ./ghost
RUN CGO_ENABLED=0 go build -a -ldflags '-extldflags "-static"' -o provisioner ./cmd/provisioner
Arie Peterson's avatar
Arie Peterson committed
17

18
RUN cp /go/src/ghost/provisioner /dist/provisioner
Arie Peterson's avatar
Arie Peterson committed
19
20
21
22
23
24
25
26
27

FROM scratch

COPY --from=buildenv /dist/provisioner /provisioner/provisioner
COPY --from=buildenv /dist/dumb-init /usr/local/bin/dumb-init
COPY --from=buildenv /dist/empty /tmp

ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["/provisioner/provisioner"]