FROM golang:1.23-alpine AS builder

WORKDIR /src
COPY apps/ldap-auth/go.mod apps/ldap-auth/go.sum ./
RUN go mod download
COPY apps/ldap-auth ./
RUN go build -o /out/ldap-auth .

FROM alpine:3.21

WORKDIR /app
RUN adduser -D -H ldap
COPY --from=builder /out/ldap-auth /app/ldap-auth

ENV PORT="8086"

EXPOSE 8086

USER ldap
CMD ["/app/ldap-auth"]
