@tasks/database (and @tasks/shared) export raw .ts files via "main" /
"exports", which works fine for tsx/dev but blows up at runtime in the
production image:
ERR_UNKNOWN_FILE_EXTENSION: Unknown file extension ".ts" for
/app/packages/database/src/client.ts
tsup was leaving those workspace imports as externals in the output, so
the deployed dist/index.mjs still tried to resolve them at startup.
Switch each app to a tsup.config.ts that sets noExternal: [/^@tasks\\//],
which inlines workspace packages into the bundle while keeping
node_modules deps (postgres, drizzle-orm, hocuspocus, mcp-sdk, etc.)
external.
Verified locally: collab-server bundle size goes from 7 KB to 304 KB,
confirming @tasks/database is now compiled in. Also fixed the collab
start script to point at index.mjs (tsup ESM output) instead of .js.
Made-with: Cursor
The 1.5GB heap cap was actually too aggressive for the Next 15 webpack
compile on this monorepo: V8 spirals into GC churn near the cap, runs
the host out of free memory, and oom-killer SIGKILLs the build (exit 255).
With 4GB on the host now:
- Cap V8 heap at 2.5GB (~70% of host RAM) — gives the compile real
headroom while leaving room for kernel + dockerd + concurrent COPY
layers from the collab/mcp runtime stages.
- Add depends_on so the lighter collab + mcp services finish building
before the web target starts its peak-memory compile, instead of
fighting it for memory in parallel.
Made-with: Cursor
next build was OOM-killed (exit 255) on the Coolify host during
'Linting and checking validity of types' — tsc pulls the whole type graph
into memory and pushes the build past available RAM.
Type-checking and linting belong in CI / pre-commit, not in the prod
container build. Skip them via next.config and cap the Node heap to 1.5 GB
so any future memory blow-up surfaces as a JS OOM instead of a SIGKILL.
Made-with: Cursor
The Next.js standalone runtime stage copies apps/web/public into the image,
but the directory was never committed since the project hasn't shipped any
static assets. BuildKit fails with "not found" on the COPY. Adding an empty
.gitkeep guarantees the directory exists at build time and lets future static
assets drop in without further build changes.
Made-with: Cursor
Collapse Dockerfile.web / Dockerfile.collab / Dockerfile.mcp into a single
docker/Dockerfile with shared `deps` stage and `web` / `collab` / `mcp`
runtime targets. BuildKit hashes the deps stage identically for all three
targets, so `pnpm install` runs once instead of three times in parallel —
fixes the OOM kill on the Coolify host (CT 107) during `docker compose build`.
Both docker-compose.yml (local dev) and docker-compose.coolify.yml now
select services via `target:` instead of separate dockerfile paths.
Made-with: Cursor
Two AI components were importing from ../../../../packages/ai/src using
relative paths that escape the workspace root. This worked locally because
all packages are siblings on disk, but failed in Docker where Dockerfile.web
only copies apps/web, packages/database, and packages/shared into the
build context — packages/ai never made it in.
Changes:
- Add @tasks/ai as a workspace dependency in apps/web/package.json
- Switch both imports (command-palette.tsx, ai-block.tsx) to "@tasks/ai"
- Add @tasks/ai to transpilePackages in next.config.ts and the docker variant
- Copy packages/ai into the Docker build context (Dockerfile.web)
- Refresh pnpm-lock.yaml for the new workspace edge
Verified locally: web builds compile cleanly past the previously failing
"Module not found" errors. (Local final step hits an unrelated ENOSPC on
the dev disk; Coolify's volume has plenty of headroom.)
Made-with: Cursor
The previous multi-stage `deps` → `builder` split copied only the root
/app/node_modules from the deps stage, but pnpm workspaces also create
per-package node_modules directories (e.g. apps/web/node_modules) that
contain the .bin symlinks for `next`, `tsup`, etc. Without those, the
builder stage failed with `sh: tsup: not found` and `sh: next: not found`.
Collapse `deps` and `builder` into a single stage so the per-package
node_modules survive intact. pnpm's content-addressable store keeps
re-installs nearly free on cache hits, and Docker layer caching still
short-circuits the install step when only source files change.
For collab and mcp runner stages, also copy the per-app node_modules
so runtime dependency resolution works.
Made-with: Cursor
Coolify invokes `docker compose` with --project-directory set to the
repository root, not this file's directory. Previous `context: ..` was
resolving to /artifacts (one level above the repo) and failing with
`resolve : lstat /artifacts/docker: no such file or directory`.
Switch all three services (web, collab, mcp) to `context: .` so the
build context is the repo root and `dockerfile: docker/Dockerfile.X`
resolves correctly.
Made-with: Cursor