# Dockerfile — shared-sqs multi-stage build
# Updated: 2026-04-12 — Go 1.23 (required by prometheus client)

FROM golang:1.23-alpine AS builder
WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -o shared-sqs ./app/cmd/

FROM alpine:3.19
RUN apk --no-cache add ca-certificates
COPY --from=builder /build/shared-sqs /usr/local/bin/shared-sqs
COPY --from=builder /build/app/conf/goaws.yaml /conf/goaws.yaml
EXPOSE 4100
HEALTHCHECK --interval=10s --timeout=5s --retries=3 \
  CMD wget -q -O - http://localhost:4100/health || exit 1
ENTRYPOINT ["shared-sqs", "--config", "/conf/goaws.yaml"]
