# Multi-stage build. docs/hub-api.md section 1: Go 1.25, static binary,
# distroless runtime, one container on 192.168.20.13.
FROM golang:1.25-alpine AS build
WORKDIR /src
COPY src/ ./
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags='-s -w' -o /out/hub .

FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /app
COPY --from=build /out/hub /app/hub
ENV HUB_PORT=8788
ENV HUB_ROUTING_FILE=/app/routing.md
ENV HUB_LOG_PATH=/tmp/hub.log
EXPOSE 8788
USER nonroot:nonroot
ENTRYPOINT ["/app/hub"]
