fix(docker): build workspace dependencies before app images

TH
3mo ago
+26-14

What does this PR do?

  • Updates the Docker build image to Bun 1.3.4 and provides a real Node.js 22 runtime for Prisma CLI commands.
  • Installs the complete app and portal workspace dependency manifests, including the local database package.
  • Builds transitive workspace dependencies before generating each application's Prisma client.
  • Copies the split Prisma schemas into the app and portal using their existing db:getschema scripts.

Issue: N/A — this fixes the Docker workspace build directly.

Visual Demo (For contributors especially)

N/A — infrastructure-only change with no UI impact.

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox. N/A: no developer documentation change is required.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

How should this be tested?

No application secrets are required for build validation.

docker buildx build --progress=plain --target app --output=type=cacheonly .
docker buildx build --progress=plain --target portal --output=type=cacheonly .
git diff --check origin/main

Validated locally:

  • App production target builds successfully, including workspace dependencies, Prisma generation, Next.js compilation, TypeScript, static generation, and final image copies.
  • Portal production target builds successfully with the same coverage.
  • Migrator target builds and prisma validate succeeds against the packaged schema.
  • Shared build runtime reports Node v22.23.1 and Bun 1.3.4 with all Node shared libraries resolved.

Repository-wide checks currently have unrelated baseline failures outside this Dockerfile-only diff:

  • API typecheck: 22 existing errors in spec files.
  • App tests: 306 files / 2,253 tests pass; 39 files / 149 tests fail in unchanged application code.

Checklist

  • I have read the contributing guide.
  • My change follows the style guidelines of this project.
  • I have commented the non-obvious Node/Prisma runtime setup.
  • I have checked that the change introduces no new blocking warnings.

Summary by cubic

Fixes Docker workspace builds by compiling transitive workspace deps before building app images and running Prisma under a real Node.js 22 runtime. Ensures @trycompai/app and @trycompai/portal reliably generate schemas and clients and produce stable images.

  • Bug Fixes
    • Build workspace deps first via bunx turbo run build --filter='@trycompai/app^...' and --filter='@trycompai/portal^...' before Prisma generation.
    • Update to Bun 1.3.4 and add Node.js 22 so Prisma CLI runs under Node; migrator uses the same runtime.
    • Install full workspace manifests, including packages/db, and use each app’s db:getschema script to copy split Prisma schemas before generating @prisma/client.