fix(docker): serialize build stages so next build doesn't OOM on the 8 GB host #1
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: rstillwell/ubiquitous-invention#1
Loading…
Reference in a new issue
No description provided.
Delete branch "hotfix/docker-build-ordering"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
exit 255~73s intonext build. Logs show no Docker error and no Node heap error — classic kernel OOM-kill signature already called out indocker/Dockerfile's own warning comment.docker/Dockerfilehas three build stages (web-build,collab-build,mcp-build) allFROM deps, so BuildKit ran them in parallel. The web build alone wants ~3 GB heap (capped at 5120 MB) and was racing both tsup workers + buildkit + dockerd on an 8 GB host until the kernel reaped it.docker-compose.coolify.ymlhad a comment claimingdepends_onon thewebservice would serialize the builds. It doesn't —depends_ononly orders runtime startup, notdocker compose build. The codebase's intent was right; the enforcement just lived in the wrong place.Fix
Enforce ordering inside the Dockerfile DAG. Two trivial
COPY --from=collab-build/COPY --from=mcp-buildlines on theweb-buildstage force BuildKit to finish the two lightweight tsup builds first. The Next.js compile then gets the host effectively to itself. Copied files land in/tmpand are never read by the runtime web image.Also updated the
docker-compose.coolify.ymlblock comment so the next person reading it doesn't fall into the samedepends_onmisconception.Test plan
main(after merge); watch logs.[collab-build]and[mcp-build]completing before[web web-build] RUN pnpm exec turbo buildstarts.next buildfinishes withoutRetrying 1/3spam and withoutexit 255.https://echodo.stillwell.cloudreturns 200 on/.Notes
Pure infrastructure change. No app code, no schema, no env contract touched. Safe to fast-forward into
mainand let Coolify pick it up on the next push.Made with Cursor