From 2f6b2865a7296034e7b1e99d043b7618331a5545 Mon Sep 17 00:00:00 2001 From: Christian Meunier Date: Sat, 8 Aug 2026 10:52:04 +0800 Subject: [PATCH] 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:*",