FROM golang:1.23-bookworm AS build
WORKDIR /src
COPY go.mod go.sum* ./
COPY gen/ gen/
COPY tools/indexer/ tools/indexer/
RUN go mod tidy
RUN CGO_ENABLED=0 go build -o /out/indexer ./tools/indexer/cmd/indexer

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/indexer /indexer
ENTRYPOINT ["/indexer"]
