This commit is contained in:
Darius
2025-09-23 23:12:53 +02:00
commit a2604a4f5e
5 changed files with 567 additions and 0 deletions

34
Dockerfile Normal file
View File

@@ -0,0 +1,34 @@
# 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 3000
CMD ["./gps-router"]