# Build stage
FROM golang:1.23-alpine AS builder

WORKDIR /app

# Copy go mod files
COPY go.mod go.sum ./
RUN go mod download

# Copy source code
COPY . .

# Build binary
RUN CGO_ENABLED=0 GOOS=linux go build -o orchestrator cmd/orchestrator/main.go

# Runtime stage
FROM alpine:latest

RUN apk --no-cache add ca-certificates docker-cli

WORKDIR /root/

# Copy binary
COPY --from=builder /app/orchestrator .

# Expose API port
EXPOSE 8080

CMD ["./orchestrator"]
