feat(maestro): build web bundle into Docker image
ci / rust (push) Successful in 1m13s

NAP-218. Add a node:20 stage to the registry Dockerfile that runs
`pnpm install && pnpm build` against `web/`, then copies the
resulting `dist/` into the Rust builder so rust-embed picks it up.
Single-binary deploy still — no separate static-asset volume.

`.dockerignore` keeps `web/node_modules` and `web/dist` out of the
build context (the node stage produces them fresh) while letting the
sources through.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-25 09:57:26 +00:00
co-authored by Claude Opus 4.7
parent 077e9e958e
commit 2a902b713e
3 changed files with 16 additions and 3 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ worktrees/
.github/ .github/
.claude/ .claude/
docs/ docs/
web/ web/node_modules/
web/dist/
*.md *.md
.env* .env*
+13
View File
@@ -9,9 +9,22 @@
# set MAESTRO_REGISTRY_BIND_ADDR to), and set MAESTRO_TOKEN as a secret env. # set MAESTRO_REGISTRY_BIND_ADDR to), and set MAESTRO_TOKEN as a secret env.
# No persistent volume is required when MAESTRO_TOKEN is provided. # No persistent volume is required when MAESTRO_TOKEN is provided.
# 1. Build the web client bundle. Output lands in /web/dist and is consumed
# by the Rust builder below via `rust-embed`.
FROM node:20-bookworm AS web-builder
WORKDIR /web
RUN corepack enable
COPY web/package.json web/pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile || pnpm install
COPY web/ ./
RUN pnpm build
# 2. Build the registry binary. `rust-embed` picks up the bundle that the
# previous stage produced.
FROM rust:1-bookworm AS builder FROM rust:1-bookworm AS builder
WORKDIR /build WORKDIR /build
COPY . . COPY . .
COPY --from=web-builder /web/dist /build/web/dist
RUN --mount=type=cache,target=/usr/local/cargo/registry \ RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/build/target \ --mount=type=cache,target=/build/target \
cargo build --release -p maestro-registry \ cargo build --release -p maestro-registry \
+1 -2
View File
@@ -17,8 +17,7 @@ use rust_embed::RustEmbed;
#[folder = "../../web/dist/"] #[folder = "../../web/dist/"]
struct WebAssets; struct WebAssets;
const FALLBACK_INDEX: &str = const FALLBACK_INDEX: &str = "<!doctype html><meta charset=utf-8><title>maestro</title>\
"<!doctype html><meta charset=utf-8><title>maestro</title>\
<h1>maestro registry</h1>\ <h1>maestro registry</h1>\
<p>Web bundle not built. Run <code>pnpm --dir web install</code> \ <p>Web bundle not built. Run <code>pnpm --dir web install</code> \
then <code>pnpm --dir web build</code>, then rebuild the registry.</p>"; then <code>pnpm --dir web build</code>, then rebuild the registry.</p>";