FROM golang:1.27-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -o /out/api ./cmd/api FROM alpine:3.20 RUN apk add --no-cache ca-certificates wget \ && addgroup -S app && adduser -S app -G app WORKDIR /app COPY --from=builder /out/api . USER app EXPOSE 8080 HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \ CMD wget -qO- http://127.0.0.1:8080/health/ready || exit 1 CMD ["./api"]