FROM golang:1.22-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -ldflags="-s -w" -o /marketplace-api .

FROM scratch
COPY --from=build /marketplace-api /marketplace-api
EXPOSE 8080
USER 65534
ENTRYPOINT ["/marketplace-api"]
