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

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