Skip to content

fix(docker): make the web image build and produce a working self-host SPA - #365

Merged
Makisuo merged 3 commits into
MapleTechLabs:mainfrom
tlvenn:fix-web-docker-build
Aug 10, 2026
Merged

fix(docker): make the web image build and produce a working self-host SPA#365
Makisuo merged 3 commits into
MapleTechLabs:mainfrom
tlvenn:fix-web-docker-build

Conversation

@tlvenn

@tlvenn tlvenn commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

First slice of the fixes offered in #352 — the smallest set that makes apps/web/Dockerfile build from a clean checkout and produce a usable self-host image:

  • Declare @maple-dev/browser in apps/web — it's imported by apps/web/src (session replay + main.tsx) but was never in package.json, so it only resolved via workspace hoisting. turbo prune @maple/web --docker therefore omits packages/browser from the pruned tree and the image build fails at bun run --cwd packages/browser build (ENOENT). Declaring the dependency fixes prune and is honest about the real dependency graph. (bun.lock delta is the one matching line.)
  • Build lib/clickhouse-builder before the web bundle@maple/query-engine imports @maple-dev/clickhouse-builder/sql and /expr, which are dist/ subpath exports; without building it first, vite fails with Rolldown failed to resolve import "@maple-dev/clickhouse-builder/sql".
  • Add VITE_ELECTRIC_SYNC_URL as a build arg — Electric shapes are the only read path for dashboards/alerts/error-issue lists, and the URL is baked at build time (apps/web/src/lib/services/common/electric-sync-url.ts), so a Docker-built SPA needs a way to set it. Defaults unchanged when unset.

Verified by building the image from a clean checkout of main and serving it (we run this image in our self-hosted deployment). Happy to follow up with the api Dockerfile / compose cleanup once you've said whether you'd rather fix or remove those (#352).


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

… SPA

- 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.
@tlvenn
tlvenn force-pushed the fix-web-docker-build branch from bbc41c1 to 2f6b286 Compare August 8, 2026 04:29
Makisuo and others added 2 commits August 11, 2026 00:30
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.
@Makisuo

Makisuo commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Thank you!!

@Makisuo
Makisuo merged commit f13e208 into MapleTechLabs:main Aug 10, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants