fix: Docker build errors — Prisma generate order, .dockerignore multi-service
Some checks failed
CI / Lint → Typecheck → Test → Build (22) (push) Failing after 11s
CI / E2E Tests (push) Has been skipped
Deploy / Build API Image (push) Failing after 23s
Deploy / Build Web Image (push) Failing after 12s
Deploy / Build AI Services Image (push) Failing after 10s
E2E Tests / Playwright E2E (push) Failing after 12s
Deploy / Deploy to Staging (push) Has been skipped
Deploy / Smoke Test Staging (push) Has been skipped
Deploy / Deploy to Production (push) Has been skipped
Deploy / Smoke Test Production (push) Has been skipped
Deploy / Rollback Staging (push) Has been skipped
Deploy / Rollback Production (push) Has been skipped

- Dockerfile: move prisma generate BEFORE nest build (fixes TS2305 PropertyType)
- .dockerignore: remove apps/web + libs/ai-services exclusions (needed by Kaniko)
- CI: add pnpm db:generate step before lint/typecheck/build

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ho Ngoc Hai
2026-04-13 15:31:08 +07:00
parent e5f7acf7da
commit b84dfd5cad
3 changed files with 37 additions and 27 deletions

View File

@@ -19,8 +19,8 @@ COPY prisma/ prisma/
RUN pnpm install --frozen-lockfile --filter @goodgo/api...
# ---- Build ----
# Compile TypeScript for mcp-servers lib (workspace dep), then the NestJS API,
# then generate the Prisma client.
# Generate Prisma client first (TS types needed at compile time),
# then compile mcp-servers lib (workspace dep), then the NestJS API.
FROM base AS build
COPY --from=deps /app/node_modules ./node_modules
COPY --from=deps /app/apps/api/node_modules ./apps/api/node_modules
@@ -30,9 +30,9 @@ COPY prisma/ prisma/
COPY libs/mcp-servers/ libs/mcp-servers/
COPY apps/api/ apps/api/
RUN pnpm --filter @goodgo/mcp-servers build 2>/dev/null || true \
&& cd apps/api && npx nest build \
&& cd /app && npx prisma generate
RUN npx prisma generate \
&& (pnpm --filter @goodgo/mcp-servers build 2>/dev/null || true) \
&& cd apps/api && npx nest build
# Use pnpm deploy to produce a flat, production-only node_modules
# This strips devDependencies and hoists only what @goodgo/api needs.