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

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