Phase 2 service decomposition per docs/SCALE-EXPANSION.md section 1: extracts
internal/{airwallex,bridge,card,tenant,httpserver} out of the monolithic
gateway into four independently deployable gRPC services (each own go.mod,
Dockerfile, and tests), with gateway now a thin BFF that fans out through new
cardissuanceclient/webhookeventsclient gRPC clients. gateway.proto's external
surface is unchanged — agent/tui/cli still talk to gateway exactly as before.
Verified: all 10 go.work modules build and `go test ./...` passes across
every one, including the new gateway client packages against the live split
services (via `make build && make test`).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
1.4 KiB
Docker
40 lines
1.4 KiB
Docker
# Build context MUST be the repo root (services/card-issuance's go.mod
|
|
# has `replace github.com/caelum0x/ration/pkg => ../../pkg`, a relative
|
|
# path into the monorepo) — build with:
|
|
# docker build -f services/card-issuance/Dockerfile -t ration/card-issuance .
|
|
#
|
|
# Multi-stage: a full Go toolchain compiles a fully static binary, then a
|
|
# distroless final image runs it. GOWORK=off throughout so the build only
|
|
# needs pkg/ + this service's own directory.
|
|
|
|
FROM golang:1.26-alpine AS build
|
|
|
|
ENV GOWORK=off \
|
|
CGO_ENABLED=0 \
|
|
GOOS=linux
|
|
|
|
WORKDIR /src
|
|
|
|
# Dependency layers first (go.sum unchanged -> this layer caches).
|
|
COPY pkg/go.mod pkg/go.sum ./pkg/
|
|
COPY services/card-issuance/go.mod services/card-issuance/go.sum ./services/card-issuance/
|
|
WORKDIR /src/services/card-issuance
|
|
RUN go mod download
|
|
|
|
WORKDIR /src
|
|
COPY pkg/ ./pkg/
|
|
COPY services/card-issuance/ ./services/card-issuance/
|
|
|
|
WORKDIR /src/services/card-issuance
|
|
RUN go build -trimpath -ldflags="-s -w" -o /out/card-issuance ./cmd/card-issuance
|
|
|
|
# distroless/static (not scratch): card-issuance makes real outbound
|
|
# HTTPS calls (Airwallex API in live mode) and needs the CA root bundle
|
|
# that static-debian12 ships, which bare `scratch` does not.
|
|
FROM gcr.io/distroless/static-debian12:nonroot
|
|
|
|
COPY --from=build /out/card-issuance /usr/local/bin/card-issuance
|
|
|
|
EXPOSE 7012
|
|
ENTRYPOINT ["/usr/local/bin/card-issuance"]
|