@@ -32,67 +32,51 @@ phases:
3232 - echo "Installing API dependencies only..."
3333 - bun install --filter=@comp/api --frozen-lockfile || bun install --filter=@comp/api --ignore-scripts || bun install --ignore-scripts
3434
35- # Build email package (required dependency for API)
3635 - echo "Building @trycompai/email package..."
3736 - cd packages/email
3837 - bun run build
3938 - cd ../..
4039
41- # Build NestJS application (prebuild automatically handles Prisma)
4240 - echo "Building NestJS application..."
4341 - echo "APP_NAME is set to $APP_NAME"
4442 - echo "Current directory $(pwd)"
4543 - echo "Available apps $(ls -la apps/)"
4644 - cd apps/api
4745 - echo "Changed to $(pwd)"
48- - echo "Running build (includes automatic prebuild db:generate)..."
4946 - bun run build
5047
51- # Verify build output exists
5248 - echo "Checking build output..."
5349 - ls -la dist/
5450 - ls -la dist/src/
5551 - ' [ -f "dist/src/main.js" ] || { echo "❌ main.js not found in dist/src"; exit 1; }'
5652
57- # Create self-contained bundle for Docker (stay in apps/api)
58- - echo "Creating self-contained bundle..."
5953 - mkdir -p ../docker-build
60-
61- # Copy built application (preserves NestJS structure)
62- - echo "Copying built application..."
6354 - cp -r dist/* ../docker-build/
64-
65- # Copy prisma folder (needed for runtime imports)
66- - echo "Copying prisma folder..."
6755 - cp -r prisma ../docker-build/
6856
69- # Verify files were copied correctly
7057 - echo "Verifying copied files..."
7158 - ls -la ../docker-build/
7259 - ls -la ../docker-build/src/
7360 - ' [ -f "../docker-build/src/main.js" ] || { echo "❌ main.js not found in docker-build/src"; exit 1; }'
7461
75- # Copy entire node_modules for runtime (includes @trycompai/db from npm)
76- - echo "Skipping host node_modules copy; Dockerfile installs prod deps inside image"
77-
78- # Copy built workspace packages (needed for runtime)
79- # Only copy packages that are actually imported at runtime
80- # Email package is already bundled, so only need its dist
81- - echo "Copying built workspace packages..."
8262 - mkdir -p ../docker-build/node_modules/@trycompai
83- # Email package - copy dist and package.json (needed at runtime)
8463 - mkdir -p ../docker-build/node_modules/@trycompai/email
8564 - cp -r ../../packages/email/dist ../docker-build/node_modules/@trycompai/email/
8665 - cp ../../packages/email/package.json ../docker-build/node_modules/@trycompai/email/
66+ - mkdir -p ../docker-build/node_modules/@trycompai/ui
67+ - cp -r ../../packages/ui/dist ../docker-build/node_modules/@trycompai/ui/
68+ - cp ../../packages/ui/package.json ../docker-build/node_modules/@trycompai/ui/
69+ - mkdir -p ../docker-build/node_modules/@trycompai/utils
70+ - cp -r ../../packages/utils/src ../docker-build/node_modules/@trycompai/utils/
71+ - cp ../../packages/utils/package.json ../docker-build/node_modules/@trycompai/utils/
72+
73+ - cp -r ../../node_modules/@prisma ../docker-build/node_modules/@prisma
74+ - cp -r ../../node_modules/.prisma ../docker-build/node_modules/.prisma
8775
88- # Copy Dockerfile
89- - echo "Copying Dockerfile..."
9076 - cp Dockerfile ../docker-build/
91- - echo "Copying package manifests for image install..."
9277 - cp package.json ../docker-build/
9378 - cp ../../bun.lock ../docker-build/ || true
9479
95- # Build Docker image
9680 - echo "Building Docker image..."
9781 - docker build --build-arg BUILDKIT_INLINE_CACHE=1 -t $ECR_REPOSITORY_URI:$IMAGE_TAG ../docker-build/
9882 - docker tag $ECR_REPOSITORY_URI:$IMAGE_TAG $ECR_REPOSITORY_URI:latest
0 commit comments