FROM golang:1.24-alpine AS builder

WORKDIR /src

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

COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /out/mengyastore-backend .

FROM alpine:3.20

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

WORKDIR /app

COPY --from=builder /out/mengyastore-backend ./mengyastore-backend

EXPOSE 8080

ENV GIN_MODE=release

CMD ["./mengyastore-backend"]
