Files
tenant-registry/Dockerfile
T
Sharang ParnerkarandClaude Opus 5.5 917fdd9ba3
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 24m43s
ci / image (pull_request) Skipped
feat(server): public GET /version with build version and commit
The staff dashboard of the portal shows which build of each service runs
(portal#64). GET /version is public like /healthz and returns
{version, commit}: the latest release tag and the full commit hash, set at
image build time with -ldflags (Dockerfile build args VERSION and COMMIT,
filled by CI). A local build reports "dev" and an empty commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
2026-10-05 21:01:16 +02:00

31 lines
1.5 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 . .
# Build version and commit for GET /version (CI passes both; portal#64).
ARG VERSION=dev
ARG COMMIT=
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X git.breakpilot.com/platform/tenant-registry/internal/buildinfo.Version=${VERSION} -X git.breakpilot.com/platform/tenant-registry/internal/buildinfo.Commit=${COMMIT}" -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 && \
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o /out/erpsetup ./cmd/erpsetup
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
COPY --from=build /out/erpsetup /erpsetup
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"]