fix: Dockerfile COPY order - node_modules must come after source
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
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:
@@ -34,15 +34,19 @@ 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/web/node_modules ./apps/web/node_modules
|
||||
|
||||
# Copy all source code
|
||||
# Copy all source code FIRST
|
||||
COPY packages ./packages
|
||||
COPY apps/web ./apps/web
|
||||
|
||||
# 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/ui/node_modules ./packages/ui/node_modules
|
||||
COPY --from=deps /app/packages/config/node_modules ./packages/config/node_modules
|
||||
COPY --from=deps /app/apps/web/node_modules ./apps/web/node_modules
|
||||
|
||||
# Build arguments for Next.js
|
||||
ARG NEXT_PUBLIC_API_URL
|
||||
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
|
||||
|
||||
Reference in New Issue
Block a user