Files

26 lines
421 B
Docker
Raw Permalink Normal View History

# Build stage
FROM golang:1.24-alpine AS builder
WORKDIR /app
# Copy go mod files first for caching
COPY go.mod go.sum ./
RUN go mod download
# Copy source and build
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o server ./cmd/server
# Final stage
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
# Copy binary from builder
COPY --from=builder /app/server .
EXPOSE 8080
CMD ["./server"]