# 第 4 层 编排调度。多阶段构建(上下文须为仓库根,因 replace ../sundynix-shared): # docker build -f sundynix-dispatcher/Dockerfile -t sundynix/dispatcher . FROM golang:1.25-alpine AS build WORKDIR /src COPY sundynix-shared/go.mod sundynix-shared/go.sum ./sundynix-shared/ COPY sundynix-dispatcher/go.mod sundynix-dispatcher/go.sum ./sundynix-dispatcher/ WORKDIR /src/sundynix-dispatcher ENV GOWORK=off GOFLAGS=-mod=mod RUN go mod download WORKDIR /src COPY sundynix-shared/ ./sundynix-shared/ COPY sundynix-dispatcher/ ./sundynix-dispatcher/ WORKDIR /src/sundynix-dispatcher RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/dispatcher ./cmd/dispatcher FROM gcr.io/distroless/static-debian12:nonroot COPY --from=build /out/dispatcher /dispatcher ENTRYPOINT ["/dispatcher"]