Dockerfile.arm64 985 B

123456789101112131415161718192021222324252627282930313233
  1. # use a builder image for building cloudflare
  2. FROM golang:1.22.10 as builder
  3. ENV GO111MODULE=on \
  4. CGO_ENABLED=0 \
  5. # the CONTAINER_BUILD envvar is used set github.com/cloudflare/cloudflared/metrics.Runtime=virtual
  6. # which changes how cloudflared binds the metrics server
  7. CONTAINER_BUILD=1
  8. WORKDIR /go/src/github.com/cloudflare/cloudflared/
  9. # copy our sources into the builder image
  10. COPY . .
  11. RUN .teamcity/install-cloudflare-go.sh
  12. # compile cloudflared
  13. RUN GOOS=linux GOARCH=arm64 PATH="/tmp/go/bin:$PATH" make cloudflared
  14. # use a distroless base image with glibc
  15. FROM gcr.io/distroless/base-debian11:nonroot-arm64
  16. LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
  17. # copy our compiled binary
  18. COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cloudflared /usr/local/bin/
  19. # run as non-privileged user
  20. USER nonroot
  21. # command / entrypoint of container
  22. ENTRYPOINT ["cloudflared", "--no-autoupdate"]
  23. CMD ["version"]