fix(docker): reorder build stages so web-build comes after its --from= sources #2

Merged
varutasu merged 1 commit from hotfix/docker-build-ordering into main 2026-06-05 22:13:40 -04:00
varutasu commented 2026-06-05 22:13:34 -04:00 (Migrated from github.com)

Summary

Follow-up to #1. The merged version of #1 fails Coolify's builder at parse time:

target web: failed to solve: cannot copy from stage "collab-build", it needs to be defined before current stage "web-build"

#1 introduced `COPY --from=collab-build` and `COPY --from=mcp-build` references inside the `web-build` stage to force BuildKit to serialize the three builds, but `web-build` was still defined above the two stages it references. That works on full BuildKit DAG builders but not on the legacy Docker builder Coolify uses, which requires forward stages to be lexically below.

Fix

Move `collab-build` and `mcp-build` above `web-build` in the file. Same DAG, same intent, same effect — just expressed in a form the older builder accepts. Added a `NOTE:` comment above the build stages so the next person who tries to "tidy up" the file order doesn't reintroduce the regression.

Pure infrastructure / file-order change. No app code, no env contract touched. Net diff vs. main is one moved stage block plus the explanatory comment.

Test plan

  • Merge → Coolify rebuilds `main`.
  • Build log shows the BuildKit DAG resolving without the "cannot copy from stage" parse error.
  • `collab-build` and `mcp-build` finish before `web web-build RUN pnpm exec turbo build` starts.
  • `next build` completes without `Retrying 1/3` spam and without `exit 255`.
  • `https://echodo.stillwell.cloud` returns 200; SSO round trip works.

Made with Cursor

## Summary Follow-up to #1. The merged version of #1 fails Coolify's builder at parse time: > target web: failed to solve: cannot copy from stage \"collab-build\", it needs to be defined before current stage \"web-build\" #1 introduced \`COPY --from=collab-build\` and \`COPY --from=mcp-build\` references inside the \`web-build\` stage to force BuildKit to serialize the three builds, but \`web-build\` was still defined **above** the two stages it references. That works on full BuildKit DAG builders but not on the legacy Docker builder Coolify uses, which requires forward stages to be lexically below. ## Fix Move \`collab-build\` and \`mcp-build\` above \`web-build\` in the file. Same DAG, same intent, same effect — just expressed in a form the older builder accepts. Added a \`NOTE:\` comment above the build stages so the next person who tries to "tidy up" the file order doesn't reintroduce the regression. Pure infrastructure / file-order change. No app code, no env contract touched. Net diff vs. main is one moved stage block plus the explanatory comment. ## Test plan - [ ] Merge → Coolify rebuilds \`main\`. - [ ] Build log shows the BuildKit DAG resolving without the \"cannot copy from stage\" parse error. - [ ] \`collab-build\` and \`mcp-build\` finish before \`web web-build RUN pnpm exec turbo build\` starts. - [ ] \`next build\` completes without \`Retrying 1/3\` spam and without \`exit 255\`. - [ ] \`https://echodo.stillwell.cloud\` returns 200; SSO round trip works. Made with [Cursor](https://cursor.com)
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: rstillwell/ubiquitous-invention#2
No description provided.