# Build stage FROM golang:1.25-alpine AS builder WORKDIR /app # Install dependencies RUN apk add --no-cache git # Copy go mod files COPY go.mod go.sum ./ RUN go mod download # Copy source code COPY . . # Build the binary RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o boc . # Final stage FROM alpine:latest RUN apk --no-cache add ca-certificates wget WORKDIR /root/ # Copy binary from builder COPY --from=builder /app/boc . # Copy migrations COPY --from=builder /app/db/migrations ./db/migrations # Expose port EXPOSE 9092 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD wget -q --spider http://localhost:9092/health || exit 1 # Run the binary CMD ["./boc"]