fix: Dockerfile COPY order - node_modules must come after source
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

Docker COPY replaces directory contents, so copying source code
after node_modules was wiping the deps. Reordered to:
1. Copy source code first
2. Copy node_modules second (won't be overwritten)

Fixes API build failure: "dist not found"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-01 13:39:25 -06:00
parent 365975d76e
commit 442c2f7de2
2 changed files with 15 additions and 8 deletions

View File

@@ -34,15 +34,18 @@ RUN --mount=type=cache,id=pnpm-store,target=/root/.local/share/pnpm/store \
# ======================
FROM base AS builder
# Copy dependencies
# Copy root node_modules from deps
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/packages ./packages
COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules
# Copy all source code
# Copy all source code FIRST
COPY packages ./packages
COPY apps/api ./apps/api
# Then copy workspace node_modules from deps (these go AFTER source to avoid being overwritten)
COPY --from=deps /app/packages/shared/node_modules ./packages/shared/node_modules
COPY --from=deps /app/packages/config/node_modules ./packages/config/node_modules
COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules
# Build the API app and its dependencies using TurboRepo
# This ensures @mosaic/shared is built first, then prisma:generate, then the API
# Cache TurboRepo build outputs for faster subsequent builds