# syntax=docker/dockerfile:1 FROM golang:1.27-alpine AS build WORKDIR /src # Dependencies are only the standard library today; the explicit copy keeps # the module cache layer stable when that changes. COPY go.mod ./ RUN go mod download COPY . . RUN CGO_ENABLED=0 GOOS=linux go build \ -trimpath -ldflags="-s -w" \ -o /out/api ./cmd/api FROM gcr.io/distroless/static-debian12:nonroot WORKDIR /app COPY --from=build /out/api /app/api # Baked fallback data lives in the image; there is no runtime data fetch. COPY --from=build /src/testdata/data /app/data ENV DATA_DIR=/app/data \ PORT=8080 EXPOSE 8080 # Numeric UID/GID: the kubelet cannot verify named users for runAsNonRoot. # 65532 is the distroless "nonroot" user. USER 65532:65532 ENTRYPOINT ["/app/api"]