# 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 the binary
RUN CGO_ENABLED=0 GOOS=linux go build -o /rdev-api ./cmd/rdev-api

# Runtime stage
FROM alpine:3.20

RUN apk --no-cache add ca-certificates wget

COPY --from=builder /rdev-api /rdev-api

EXPOSE 8080

CMD ["/rdev-api"]
