# Build stage FROM golang:1.21-alpine AS builder WORKDIR /app # Copy go mod files COPY go.mod go.sum ./ # Download dependencies RUN go mod download # Copy source code COPY *.go ./ # Build the application RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gps-router . # Final stage FROM alpine:latest RUN apk --no-cache add ca-certificates wget WORKDIR /root/ # Copy the binary from builder stage COPY --from=builder /app/gps-router . # Create non-root user RUN adduser -D -s /bin/sh gpsrouter USER gpsrouter EXPOSE 3069 CMD ["./gps-router"]