FROM golang:1.24-alpine AS build

WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /abstract-wizard .

FROM gcr.io/distroless/static-debian12

COPY --from=build /abstract-wizard /abstract-wizard

USER nonroot:nonroot

ENV CONFIG_DIR=/config
ENV LISTEN_ADDR=0.0.0.0:8080
EXPOSE 8080

VOLUME /config

ENTRYPOINT ["/abstract-wizard"]
