# Build stage FROM golang:1.24.3-alpine AS builder WORKDIR /app # Copy go mod and sum files COPY go.mod ./ # Download dependencies RUN go mod download # Copy source code COPY . . # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -o main . # Final stage FROM alpine:latest WORKDIR /app # Copy the binary from builder COPY --from=builder /app/main . # Expose the port EXPOSE ${PORT} # Run the application CMD ["./main"]