# Stage 1: build with the full Go toolchain
FROM golang:1.26-alpine AS build
WORKDIR /src
COPY go.mod ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /server .

# Stage 2: ship only the binary
FROM gcr.io/distroless/static-debian13
COPY --from=build /server /server
EXPOSE 8080
ENTRYPOINT ["/server"]
