FROM golang:1.23-alpine AS builder

WORKDIR /src
COPY apps/media-ws/go.mod apps/media-ws/go.sum ./
RUN go mod download
COPY apps/media-ws ./
RUN go build -o /out/media-ws .

FROM alpine:3.21

WORKDIR /app
RUN adduser -D -H media
COPY --from=builder /out/media-ws /app/media-ws

ENV PORT="8085"
ENV REDIS_ADDR="redis:6379"
ENV RABBITMQ_URL="amqp://lendry:lendry_password@rabbitmq:5672/"

EXPOSE 8085

USER media
CMD ["/app/media-ws"]
