diff --git a/docker/Dockerfile b/docker/Dockerfile index f10a608..ceb15ca 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -51,9 +51,11 @@ COPY docker/next.config.docker.ts ./apps/web/next.config.ts ENV NEXT_TELEMETRY_DISABLED=1 ENV NODE_ENV=production -# Cap V8 heap so we get a clean JS OOM instead of a kernel SIGKILL (exit 255) -# if memory pressure spikes during the build on small hosts. -ENV NODE_OPTIONS=--max-old-space-size=1536 +# Give the Next.js webpack compile enough V8 heap headroom on the Coolify host. +# Sized to ~70% of the 4 GB host RAM so kernel + dockerd + concurrent runtime +# COPYs from collab/mcp still have breathing room. Below ~2 GB, the compile +# spirals into GC churn and gets oom-killed (exit 255 with no Docker error). +ENV NODE_OPTIONS=--max-old-space-size=2560 RUN pnpm exec turbo build --filter=@tasks/web diff --git a/docker/docker-compose.coolify.yml b/docker/docker-compose.coolify.yml index 7f7134c..15f3d8a 100644 --- a/docker/docker-compose.coolify.yml +++ b/docker/docker-compose.coolify.yml @@ -19,9 +19,13 @@ # # Build strategy: # All three services share docker/Dockerfile and select runtime via `target:`. -# The shared `deps` stage (pnpm install for the whole workspace) is hashed -# identically across targets, so BuildKit runs it ONCE even when web/collab/mcp -# build in parallel — keeps build-host RAM bounded. +# The shared `deps` stage is hashed identically across targets, so BuildKit +# runs `pnpm install` ONCE. +# +# `web` declares depends_on collab+mcp so Compose builds the lightweight +# services first and the heavy `next build` (peak ~2.5 GB heap) gets the host +# effectively to itself instead of fighting concurrent runtime-stage COPYs +# for memory. services: web: @@ -29,6 +33,9 @@ services: context: . dockerfile: docker/Dockerfile target: web + depends_on: + - collab + - mcp restart: unless-stopped environment: # Coolify FQDN magic var — set the domain in the Coolify UI for this service.