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

@@ -1,7 +1,19 @@
# =============================================================================
# .dockerignore — shared across ALL Dockerfiles (api, web, ai-services)
# All 3 Dockerfiles build from repo root context, so do NOT exclude
# apps/web or libs/ai-services here.
# =============================================================================
# Build outputs & caches (rebuilt inside Docker)
node_modules
.next
dist
*.tsbuildinfo
.turbo
.cache
.nx
.eslintcache
coverage
# Version control
.git
@@ -9,15 +21,21 @@ dist
.husky
.gitignore
# Documentation and tests
# Documentation, tests, monitoring (not needed in any build)
docs
e2e
load-tests
monitoring
playwright-report
*.md
!README.md
playwright.config.ts
CHANGELOG.md
CONTRIBUTING.md
SEED_GENERATION_SCRIPT.ts
# Environment and secrets
.env*
# Environment and secrets (NEVER ship into images)
.env
.env.ci
.env.test
!.env.example
# IDE and editor
@@ -26,35 +44,24 @@ playwright-report
*.swp
*.swo
# Build caches
.eslintcache
coverage
.turbo
.cache
.nx
# OS files
.DS_Store
Thumbs.db
# Docker files (avoid recursive context)
# Docker / infra files (avoid recursive context)
docker-compose*.yml
Dockerfile*
monitoring
infra
# Dev tools
scripts/backup
# Dev tools & scripts (not needed at build time)
scripts
*.log
# Python / AI services (not needed for API build)
libs/ai-services
# Python caches (rebuilt inside AI container)
__pycache__
*.pyc
.venv
# Frontend (not needed for API build, has its own Dockerfile)
apps/web
# Agent configs (Paperclip / Claude)
# Agent / Claude configs
.claude
agents

View File

@@ -55,6 +55,9 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate Prisma client
run: pnpm db:generate
- name: Lint
run: pnpm lint

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.