jobs-monorepo/services/api/Dockerfile
Заид Омар Медхат | Zaid Omar Medhat 18842091a4 fix: add migrations to docker
2025-12-16 18:31:54 +05:00

36 lines
638 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 .
# Copy migrations
COPY --from=builder /build/internal/migrations ./internal/migrations
EXPOSE 8080
# Run the API
ENTRYPOINT ["./api"]