caelum0x f377d2b7d8 feat(ledgerline): add a real Dockerfile and deploy it live on railyard-box
Ledgerline (revenue vs AI cost margin lens) had a complete, well-tested
single-crate Rust server but no Dockerfile and no deploy scaffolding at
all, unlike Vend/Turnstile/Abacus which at least had prepared compose
profiles. Checked Context Passport as the other candidate the plan names
as "Slice/not deployed" — it is also real and solid, but its generate
path has more moving parts (Relay round trip + settlement + provenance);
Ledgerline's narrower surface (ingest event -> settle via Mint -> query
margin) was the more honest first real deploy.

Added a standalone distroless Dockerfile (same shape as Toolgate/Vend's),
a `ledgerline` compose profile wired to the real, already-live Railyard
Mint with four real Mint accounts (revenue, COGS, one provider, one
customer), a Caddy site, and its own Postgres database.

Verified live end-to-end against the deployed container: a real
success-path event correctly reached Mint and was refused with a real
402 insufficient_funds (cross-checked against Mint's own balance
endpoint — same ledger, not a stub); a failed-outcome event settled with
no Mint calls; margin lookup, margin-by-customer, and the group-by
rollup all returned the real stored data; an event naming a
non-allowlisted account was correctly refused 403 before touching Mint;
/admin renders.

Full detail in apps/ledgerline/README.md's new "Deployed" section.
2026-10-28 05:36:55 +03:00

28 lines
894 B
Docker

# syntax=docker/dockerfile:1.7
#
# apps/ledgerline: Ledgerline margin-lens server. Standalone single-crate
# package (not a cargo workspace member of the repo root), so the build
# context is this directory:
#
# docker build -t railyard/ledgerline apps/ledgerline
#
# Runtime is distroless (CA bundle only); sqlx and reqwest use rustls, so
# there is no OpenSSL. Serves on :8093 by default (LEDGERLINE_BIND_ADDR).
FROM rust:1.94-bookworm AS builder
WORKDIR /src
COPY Cargo.toml Cargo.lock ./
COPY src ./src
COPY assets ./assets
COPY migrations ./migrations
RUN cargo build --release --bin ledgerline-server \
&& strip target/release/ledgerline-server
FROM gcr.io/distroless/cc-debian12:nonroot
WORKDIR /app
COPY --from=builder /src/target/release/ledgerline-server /app/ledgerline-server
ENV LEDGERLINE_BIND_ADDR=0.0.0.0:8093
EXPOSE 8093
USER nonroot
ENTRYPOINT ["/app/ledgerline-server"]