2019-12-17 01:25:17 +00:00
|
|
|
# use a builder image for building cloudflare
|
|
|
|
FROM golang:1.13.3 as builder
|
2019-11-22 16:27:28 +00:00
|
|
|
ENV GO111MODULE=on
|
|
|
|
ENV CGO_ENABLED=0
|
|
|
|
ENV GOOS=linux
|
2019-12-17 01:25:17 +00:00
|
|
|
|
2019-04-29 21:25:34 +00:00
|
|
|
WORKDIR /go/src/github.com/cloudflare/cloudflared/
|
2019-12-17 01:25:17 +00:00
|
|
|
|
|
|
|
# copy our sources into the builder image
|
2019-04-29 21:25:34 +00:00
|
|
|
COPY . .
|
2019-12-17 01:25:17 +00:00
|
|
|
|
|
|
|
# compile cloudflared
|
2019-04-29 21:25:34 +00:00
|
|
|
RUN make cloudflared
|
|
|
|
|
2019-12-17 01:25:17 +00:00
|
|
|
# ---
|
|
|
|
|
|
|
|
# use a distroless base image with glibc
|
|
|
|
FROM gcr.io/distroless/base-debian10:nonroot
|
|
|
|
|
|
|
|
# copy our compiled binary
|
|
|
|
COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
|
|
|
|
|
|
|
|
# run as non-privileged user
|
|
|
|
USER nonroot
|
|
|
|
|
|
|
|
# command / entrypoint of container
|
2019-04-29 21:25:34 +00:00
|
|
|
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
|
|
|
|
CMD ["version"]
|