feature/epic2-core-services #6
36
cmd/api-gateway/Dockerfile
Normal file
36
cmd/api-gateway/Dockerfile
Normal file
@@ -0,0 +1,36 @@
|
||||
# Build stage
|
||||
FROM golang:1.25-alpine AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# Install build dependencies
|
||||
RUN apk add --no-cache git make
|
||||
|
||||
# Copy go mod files
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Copy source code
|
||||
COPY . .
|
||||
|
||||
# Build the service
|
||||
WORKDIR /build/cmd/api-gateway
|
||||
RUN CGO_ENABLED=0 GOOS=linux go build -o api-gateway -a -installsuffix cgo .
|
||||
|
||||
# Runtime stage
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk --no-cache add ca-certificates tzdata
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy binary from builder
|
||||
COPY --from=builder /build/cmd/api-gateway/api-gateway .
|
||||
|
||||
# Copy config files
|
||||
COPY --from=builder /build/config ./config
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD ["./api-gateway"]
|
||||
|
||||
Reference in New Issue
Block a user