30 lines
846 B
Docker
30 lines
846 B
Docker
# use a builder image for building cloudflare
|
|
FROM golang:1.21.5 as builder
|
|
ENV GO111MODULE=on \
|
|
CGO_ENABLED=0
|
|
|
|
WORKDIR /go/src/github.com/cloudflare/cloudflared/
|
|
|
|
# copy our sources into the builder image
|
|
COPY . .
|
|
|
|
RUN .teamcity/install-cloudflare-go.sh
|
|
|
|
# compile cloudflared
|
|
RUN GOOS=linux GOARCH=arm64 PATH="/go/src/github.com/cloudflare/cloudflared/go/bin:$PATH" make cloudflared
|
|
|
|
# use a distroless base image with glibc
|
|
FROM gcr.io/distroless/base-debian11:nonroot-arm64
|
|
|
|
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
|
|
|
|
# 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
|
|
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
|
|
CMD ["version"]
|