Files
tenant-registry/Dockerfile
T
Sharang ParnerkarandClaude Fable 5.1 0cb0883846
ci / shared (pull_request) Successful in 13s
ci / test (pull_request) Successful in 22m5s
ci / image (pull_request) Skipped
feat(server): MIGRATE_ON_START; image CMD instead of ENTRYPOINT
orca's `cmd` sets the container CMD, so with an ENTRYPOINT the stage
service ran `/tenant-registry /bin/sh -c …` (no migrations) and the
erpmock service ran the registry. The image now has CMD only and the
server applies embedded migrations itself when MIGRATE_ON_START=true.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-09-12 10:09:59 +02:00

26 lines
1.1 KiB
Docker

# Multi-stage build for tenant-registry.
# Produces two binaries:
# /tenant-registry — long-running API server
# /migrate — one-shot schema migrator (Orca init container in prod)
# /erpmock — ERPNext stand-in for staging (decision 18; cmd/erpmock)
FROM golang:1.25-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/tenant-registry ./cmd/server && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/migrate ./cmd/migrate && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/erpmock ./cmd/erpmock
FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /
COPY --from=build /out/tenant-registry /tenant-registry
COPY --from=build /out/migrate /migrate
COPY --from=build /out/erpmock /erpmock
USER nonroot:nonroot
EXPOSE 8090
# CMD (not ENTRYPOINT) so orca's `cmd` can select /erpmock or /migrate in the
# same image. The server applies migrations itself with MIGRATE_ON_START=true.
CMD ["/tenant-registry"]