FROM golang:1.25-alpine AS builder
WORKDIR /usr/src/kurumi
COPY go.mod go.sum ./
RUN go mod download
COPY ./database ./database
COPY ./laniakea ./laniakea
COPY ./plugins ./plugins
COPY ./utils ./utils
COPY ./main.go ./
RUN --mount=type=cache,target=/go/pkg/mod go build -trimpath -o /usr/local/bin/kurumi ./

FROM alpine AS runner
WORKDIR /app
COPY --from=builder /usr/local/bin/kurumi /app/kurumi
CMD ["/app/kurumi"]