checker-caa/Dockerfile
Pierre-Olivier Mercier 798d50bf6c docker: add HEALTHCHECK probing /health
The binary doubles as its own healthcheck client via the SDK's
-healthcheck flag, so the probe works in the scratch image
(no shell, no curl, no wget).
2026-04-26 19:44:52 +07:00

17 lines
491 B
Docker

FROM golang:1.25-alpine AS builder
ARG CHECKER_VERSION=custom-build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go generate ./... && CGO_ENABLED=0 go build -tags standalone -ldflags "-X main.Version=${CHECKER_VERSION}" -o /checker-caa .
FROM scratch
COPY --from=builder /checker-caa /checker-caa
USER 65534:65534
EXPOSE 8080
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD ["/checker-caa", "-healthcheck"]
ENTRYPOINT ["/checker-caa"]