FROM golang:1.24-alpine AS builder

# Install make for Makefile support
RUN apk add --no-cache make

WORKDIR /app

COPY go.mod go.sum ./
RUN go mod download

COPY . .

# Use Makefile to generate swagger and build
RUN make build

FROM alpine:latest

WORKDIR /app

COPY --from=builder /app/ez-api .

EXPOSE 8080

CMD ["./ez-api"]
