Skip to content

Commit 0d5de44

Browse files
authored
chore(api): update buildspec and Dockerfile to copy pre-built workspace packages (#1769)
1 parent a218539 commit 0d5de44

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed

apps/api/Dockerfile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ WORKDIR /app
1010
COPY package.json ./
1111

1212
# Install bun and deps
13+
# Note: workspace:* dependencies will be skipped and copied manually below
1314
RUN curl -fsSL https://bun.sh/install | bash \
1415
&& export PATH="/root/.bun/bin:$PATH" \
15-
&& bun install --production --ignore-scripts
16+
&& bun install --production --ignore-scripts || true
17+
18+
# Copy pre-built workspace packages (must be before copying app contents)
19+
COPY node_modules/@trycompai ./node_modules/@trycompai
1620

1721
# Now copy the pre-built app contents (dist/, prisma/, etc.)
1822
COPY . .

apps/api/buildspec.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ 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 workspace dependencies (ui -> email)
36+
- echo "Building @trycompai/ui package..."
37+
- cd packages/ui
38+
- bun run build
39+
- cd ../..
40+
- echo "Building @trycompai/email package..."
41+
- cd packages/email
42+
- bun run build
43+
- cd ../..
44+
3545
# Build NestJS application (prebuild automatically handles Prisma)
3646
- echo "Building NestJS application..."
3747
- echo "APP_NAME is set to $APP_NAME"
@@ -69,6 +79,23 @@ phases:
6979
# Copy entire node_modules for runtime (includes @trycompai/db from npm)
7080
- echo "Skipping host node_modules copy; Dockerfile installs prod deps inside image"
7181

82+
# Copy built workspace packages (needed for runtime)
83+
# These packages are built above and need to be available in Docker
84+
- echo "Copying built workspace packages..."
85+
- mkdir -p ../docker-build/node_modules/@trycompai
86+
# Email package - copy dist and package.json
87+
- mkdir -p ../docker-build/node_modules/@trycompai/email
88+
- cp -r ../../packages/email/dist ../docker-build/node_modules/@trycompai/email/
89+
- cp ../../packages/email/package.json ../docker-build/node_modules/@trycompai/email/
90+
# UI package - copy dist and package.json
91+
- mkdir -p ../docker-build/node_modules/@trycompai/ui
92+
- cp -r ../../packages/ui/dist ../docker-build/node_modules/@trycompai/ui/
93+
- cp ../../packages/ui/package.json ../docker-build/node_modules/@trycompai/ui/
94+
# Utils package - copy src (no build step) and package.json
95+
- mkdir -p ../docker-build/node_modules/@trycompai/utils
96+
- cp -r ../../packages/utils/src ../docker-build/node_modules/@trycompai/utils/
97+
- cp ../../packages/utils/package.json ../docker-build/node_modules/@trycompai/utils/
98+
7299
# Copy Dockerfile
73100
- echo "Copying Dockerfile..."
74101
- cp Dockerfile ../docker-build/

apps/api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"@nestjs/swagger": "^11.2.0",
1414
"@prisma/client": "^6.13.0",
1515
"@trycompai/db": "^1.3.17",
16+
"@trycompai/email": "workspace:*",
1617
"archiver": "^7.0.1",
1718
"axios": "^1.12.2",
1819
"better-auth": "^1.3.27",

0 commit comments

Comments
 (0)