# build
FROM golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod ./
COPY main.go ./
RUN go mod tidy && CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags "-s -w" -o /stats .

# runtime (minimal)
FROM scratch
COPY --from=build /stats /stats
ENTRYPOINT ["/stats"]
