32 lines
513 B
Docker
32 lines
513 B
Docker
# Build stage
|
|
FROM golang:1.24-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy go mod files
|
|
COPY go.mod go.sum ./
|
|
RUN go mod download
|
|
|
|
# Copy source code
|
|
COPY . .
|
|
|
|
# Build the application
|
|
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o spore-gateway ./main.go
|
|
|
|
# Runtime stage
|
|
FROM alpine:latest
|
|
|
|
RUN apk --no-cache add ca-certificates
|
|
|
|
WORKDIR /root/
|
|
|
|
# Copy the binary from builder
|
|
COPY --from=builder /app/spore-gateway .
|
|
|
|
# Expose ports
|
|
EXPOSE 3001 4210
|
|
|
|
# Run the application
|
|
CMD ["./spore-gateway"]
|
|
|