From 2f6b2865a7296034e7b1e99d043b7618331a5545 Mon Sep 17 00:00:00 2001 From: Christian Meunier Date: Sat, 8 Aug 2026 10:52:04 +0800 Subject: [PATCH 1/2] fix(docker): make the web image build and produce a working self-host SPA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Declare @maple-dev/browser in apps/web — it is imported by apps/web/src but resolved only via workspace hoisting, so turbo prune --docker omits packages/browser and the image build fails at its dist build step. - Build lib/clickhouse-builder before the web bundle — @maple/query-engine imports its dist/ subpath exports; without it vite fails to resolve @maple-dev/clickhouse-builder/sql. - Add VITE_ELECTRIC_SYNC_URL build arg — Electric shapes are the only read path for dashboards/alerts/error lists and the URL is baked at build time, so a Docker-built SPA needs a way to set it. --- apps/web/Dockerfile | 5 ++++- apps/web/package.json | 1 + bun.lock | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 6f7261f08..49d1931dd 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -16,14 +16,17 @@ RUN bun install COPY --from=pruner /app/out/full/ ./ # Build workspace dependencies that publish from dist/ -RUN bun run --cwd packages/browser build && \ +RUN bun run --cwd lib/clickhouse-builder build && \ + bun run --cwd packages/browser build && \ bun run --cwd packages/effect-sdk build # Build-time env vars (baked into the SPA bundle) ARG VITE_API_BASE_URL ARG VITE_MAPLE_AUTH_MODE=self_hosted +ARG VITE_ELECTRIC_SYNC_URL ENV VITE_API_BASE_URL=$VITE_API_BASE_URL ENV VITE_MAPLE_AUTH_MODE=$VITE_MAPLE_AUTH_MODE +ENV VITE_ELECTRIC_SYNC_URL=$VITE_ELECTRIC_SYNC_URL RUN bun run --cwd apps/web build diff --git a/apps/web/package.json b/apps/web/package.json index 7fb86a7fb..6a7a68ce8 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -27,6 +27,7 @@ "@effect/atom-react": "catalog:effect", "@fontsource-variable/geist": "^5.2.9", "@fontsource-variable/geist-mono": "^5.2.8", + "@maple-dev/browser": "workspace:*", "@maple-dev/effect-sdk": "workspace:*", "@maple/domain": "workspace:*", "@maple/effect-db": "workspace:*", diff --git a/bun.lock b/bun.lock index 20f093daa..acef07d4c 100644 --- a/bun.lock +++ b/bun.lock @@ -267,6 +267,7 @@ "@effect/atom-react": "catalog:effect", "@fontsource-variable/geist": "^5.2.9", "@fontsource-variable/geist-mono": "^5.2.8", + "@maple-dev/browser": "workspace:*", "@maple-dev/effect-sdk": "workspace:*", "@maple/domain": "workspace:*", "@maple/effect-db": "workspace:*", From 6af6ffdebe7dfeded22c63a8d96b8082b97f2112 Mon Sep 17 00:00:00 2001 From: Makisuo Date: Tue, 11 Aug 2026 00:34:11 +0200 Subject: [PATCH 2/2] fix(docker): drop the packages/browser build instead of faking a web dep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apps/web never imports @maple-dev/browser — main.tsx says so explicitly, and the SDK reaches replay through @maple/browser-session via @maple-dev/effect-sdk. The Dockerfile's `bun run --cwd packages/browser build` step was the actual bug: turbo prune correctly omits a package apps/web does not depend on, so the cwd does not exist in the image. Declaring @maple-dev/browser in apps/web/package.json papered over that by dragging the package back into the prune, at the cost of an unused dependency — which is what Knip failed on. Remove the build step instead. The Electric build arg and the lib/clickhouse-builder build stay: @maple/query-engine imports @maple-dev/clickhouse-builder/sql from dist/, and VITE_ELECTRIC_SYNC_URL is baked at build time by vite.config.ts. --- apps/web/Dockerfile | 1 - apps/web/package.json | 1 - bun.lock | 1 - 3 files changed, 3 deletions(-) diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile index 49d1931dd..9ba04f1b4 100644 --- a/apps/web/Dockerfile +++ b/apps/web/Dockerfile @@ -17,7 +17,6 @@ COPY --from=pruner /app/out/full/ ./ # Build workspace dependencies that publish from dist/ RUN bun run --cwd lib/clickhouse-builder build && \ - bun run --cwd packages/browser build && \ bun run --cwd packages/effect-sdk build # Build-time env vars (baked into the SPA bundle) diff --git a/apps/web/package.json b/apps/web/package.json index 0f7dbc0f9..b7ebfcfbe 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -27,7 +27,6 @@ "@effect/atom-react": "catalog:effect", "@fontsource-variable/geist": "^5.2.9", "@fontsource-variable/geist-mono": "^5.2.8", - "@maple-dev/browser": "workspace:*", "@maple-dev/effect-sdk": "workspace:*", "@maple/domain": "workspace:*", "@maple/effect-db": "workspace:*", diff --git a/bun.lock b/bun.lock index 851691517..01673ef7f 100644 --- a/bun.lock +++ b/bun.lock @@ -262,7 +262,6 @@ "@effect/atom-react": "catalog:effect", "@fontsource-variable/geist": "^5.2.9", "@fontsource-variable/geist-mono": "^5.2.8", - "@maple-dev/browser": "workspace:*", "@maple-dev/effect-sdk": "workspace:*", "@maple/domain": "workspace:*", "@maple/effect-db": "workspace:*",