# Dockerfile FROM docker.io/library/golang:1.23-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . # Build with optimization flags RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-w -s" -o /app/crm-core ./cmd/api # Use Google Distroless static image for minimal size and security FROM gcr.io/distroless/static:nonroot WORKDIR /app COPY --from=builder /app/crm-core . # Non-root user for security USER nonroot:nonroot EXPOSE 8080 CMD ["./crm-core"]