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

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