checker-ping/Dockerfile
Pierre-Olivier Mercier 394d7e8e4c Run container as non-root user
Add USER 65534:65534 to the scratch runtime image so the checker
process does not run as root.
2026-04-26 10:19:14 +07:00

15 lines
363 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 CGO_ENABLED=0 go build -tags standalone -ldflags "-X main.Version=${CHECKER_VERSION}" -o /checker-ping .
FROM scratch
COPY --from=builder /checker-ping /checker-ping
USER 65534:65534
EXPOSE 8080
ENTRYPOINT ["/checker-ping"]