# The AISP build gateway only allows base images from approved mirrors, written with the
# full host (docker.io/..., harbor.vts-ai.space/...).
FROM docker.io/library/golang:1.23-alpine AS build
WORKDIR /src
COPY go.mod main.go ./
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server .

# A static binary on scratch keeps the pushed image to a few MB; large layers time out
# on the way to Harbor.
FROM scratch
COPY --from=build /out/server /server

# AISP enforces PodSecurity "restricted": run as a non-root UID on a port above 1024.
USER 10001
ENV PORT=8080 \
    APP_MESSAGE="Hello from AISP"
EXPOSE 8080

ENTRYPOINT ["/server"]
