jobs-monorepo/services/api/Dockerfile
Elshimy Ziad Magdy Taha 3187757776 docker for api
2025-12-16 18:05:47 +05:00

33 lines
550 B
Docker

# Build stage
FROM golang:1.24-alpine AS builder
# Install build dependencies
RUN apk add --no-cache git
WORKDIR /build
# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download
# Copy the entire monorepo
COPY . .
# Build the API service
WORKDIR /build/services/api
RUN CGO_ENABLED=0 GOOS=linux go build -o api ./cmd/server
# Runtime stage
FROM alpine:latest
RUN apk add --no-cache ca-certificates
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /build/services/api/api .
EXPOSE 8080
# Run the API
ENTRYPOINT ["./api"]