# Builder stage
FROM golang:1.25.5-alpine AS builder

WORKDIR /app
COPY go.mod go.sum ./
# RUN go mod download command
COPY . .
RUN go build -ldflags="-s -w" -o ./bin/web ./cmd/main.go

# Runner stage
FROM alpine:3.21 AS runner
WORKDIR /app
COPY .env .
COPY --from=builder /app/bin/web /app/bin/web
RUN apk add --no-cache ca-certificates
EXPOSE ${PORT}
CMD ["/app/bin/web"]
