FROM golang:1.26-alpine AS build
WORKDIR /src
COPY shared/ shared/
COPY billing/go.mod billing/go.sum billing/
WORKDIR /src/billing
RUN go mod download
COPY billing/ .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /billing .

FROM scratch
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=build /billing /billing
EXPOSE 8085
USER 65534
ENTRYPOINT ["/billing"]
