Dockerfile 730 B

123456789101112131415161718192021222324252627282930
  1. # use a builder image for building cloudflare
  2. ARG TARGET_GOOS
  3. ARG TARGET_GOARCH
  4. FROM golang:1.15.7 as builder
  5. ENV GO111MODULE=on \
  6. CGO_ENABLED=0 \
  7. TARGET_GOOS=${TARGET_GOOS} \
  8. TARGET_GOARCH=${TARGET_GOARCH}
  9. WORKDIR /go/src/github.com/cloudflare/cloudflared/
  10. # copy our sources into the builder image
  11. COPY . .
  12. # compile cloudflared
  13. RUN make cloudflared
  14. # use a distroless base image with glibc
  15. FROM gcr.io/distroless/base-debian10:nonroot
  16. # copy our compiled binary
  17. COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
  18. # run as non-privileged user
  19. USER nonroot
  20. # command / entrypoint of container
  21. ENTRYPOINT ["cloudflared", "--no-autoupdate"]
  22. CMD ["version"]