Add healthcheck by default

This commit is contained in:
Macley 2026-01-30 22:22:39 +01:00 committed by GitHub
parent d7c62aed71
commit a64a7463e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 0 deletions

View File

@ -21,6 +21,8 @@ RUN make cloudflared
# use a distroless base image with glibc
FROM gcr.io/distroless/base-debian13:nonroot
# Enable metrics for healthcheck
ENV TUNNEL_METRICS=127.0.0.1:60123
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
@ -33,6 +35,10 @@ COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cl
# The `nonroot` user maps to `65532`, from: https://github.com/GoogleContainerTools/distroless/blob/main/common/variables.bzl#L18
USER 65532:65532
# Check if cloudflared is healthy
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
CMD cloudflared tunnel --metrics localhost:60123 ready
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -16,6 +16,8 @@ RUN GOOS=linux GOARCH=amd64 make cloudflared
# use a distroless base image with glibc
FROM gcr.io/distroless/base-debian13:nonroot
# Enable metrics for healthcheck
ENV TUNNEL_METRICS=127.0.0.1:60123
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
@ -28,6 +30,10 @@ COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cl
# The `nonroot` user maps to `65532`, from: https://github.com/GoogleContainerTools/distroless/blob/main/common/variables.bzl#L18
USER 65532:65532
# Check if cloudflared is healthy
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
CMD cloudflared tunnel --metrics localhost:60123 ready
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]

View File

@ -16,6 +16,8 @@ RUN GOOS=linux GOARCH=arm64 make cloudflared
# use a distroless base image with glibc
FROM gcr.io/distroless/base-debian13:nonroot-arm64
# Enable metrics for healthcheck
ENV TUNNEL_METRICS=127.0.0.1:60123
LABEL org.opencontainers.image.source="https://github.com/cloudflare/cloudflared"
@ -28,6 +30,10 @@ COPY --from=builder --chown=nonroot /go/src/github.com/cloudflare/cloudflared/cl
# The `nonroot` user maps to `65532`, from: https://github.com/GoogleContainerTools/distroless/blob/main/common/variables.bzl#L18
USER 65532:65532
# Check if cloudflared is healthy
HEALTHCHECK --interval=30s --timeout=30s --retries=3 \
CMD cloudflared tunnel --metrics localhost:60123 ready
# command / entrypoint of container
ENTRYPOINT ["cloudflared", "--no-autoupdate"]
CMD ["version"]