FROM golang:1.25-alpine AS builder

RUN apk add --no-cache git

WORKDIR /build

COPY go-wst/ go-wst/
COPY juwan-backend/go.mod juwan-backend/go.sum juwan-backend/
WORKDIR /build/juwan-backend
RUN go mod download

COPY juwan-backend/ /build/juwan-backend/
RUN CGO_ENABLED=0 go build -o /chat-api ./app/chat/api/

FROM alpine:latest
COPY --from=builder /chat-api /chat-api
COPY juwan-backend/app/chat/test/chat-api-test.yaml /etc/chat-api.yaml
CMD ["/chat-api", "-f", "/etc/chat-api.yaml"]
