Skip to content

Commit 10d1f83

Browse files
authored
Mariano/fix 6 (#1890)
* refactor(api): simplify Dockerfile and buildspec for node_modules management
1 parent 4601e42 commit 10d1f83

File tree

2 files changed

+8
-22
lines changed

2 files changed

+8
-22
lines changed

apps/api/Dockerfile

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,11 @@ RUN apk add --no-cache wget curl bash libc6-compat openssl
66

77
WORKDIR /app
88

9-
# Copy manifests first and install production deps inside the image (avoid broken bun symlinks)
9+
# Copy package.json and pre-installed node_modules from buildspec
1010
COPY package.json ./
11+
COPY node_modules ./node_modules
1112

12-
# Install bun and deps
13-
# Note: workspace:* dependencies will be skipped and copied manually below
14-
RUN curl -fsSL https://bun.sh/install | bash \
15-
&& export PATH="/root/.bun/bin:$PATH" \
16-
&& bun install --production --ignore-scripts
17-
18-
COPY node_modules/@trycompai ./node_modules/@trycompai
19-
COPY node_modules/@comp ./node_modules/@comp
20-
COPY node_modules/@prisma ./node_modules/@prisma
21-
COPY node_modules/.prisma ./node_modules/.prisma
22-
13+
# Copy built application and prisma files
2314
COPY . .
2415

2516
# Set environment variables

apps/api/buildspec.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,15 @@ phases:
6161
- ls -la ../docker-build/src/
6262
- '[ -f "../docker-build/src/main.js" ] || { echo "❌ main.js not found in docker-build/src"; exit 1; }'
6363

64-
- mkdir -p ../docker-build/node_modules/@trycompai
65-
- mkdir -p ../docker-build/node_modules/@trycompai/utils
66-
- mkdir -p ../docker-build/node_modules/@trycompai/db
64+
# Copy ALL node_modules from root (already installed with production deps)
65+
- echo "Copying node_modules from root..."
66+
- cp -r ../../node_modules ../docker-build/
67+
68+
# Override workspace packages with built versions
6769
- cp -r ../../packages/utils/src ../docker-build/node_modules/@trycompai/utils/
6870
- cp ../../packages/utils/package.json ../docker-build/node_modules/@trycompai/utils/
69-
7071
- cp -r ../../packages/db/dist ../docker-build/node_modules/@trycompai/db/
7172
- cp ../../packages/db/package.json ../docker-build/node_modules/@trycompai/db/
72-
73-
- cp -r ../../node_modules/@prisma ../docker-build/node_modules/@prisma
74-
- cp -r ../../node_modules/.prisma ../docker-build/node_modules/.prisma
75-
76-
# Integration platform (workspace package)
77-
- mkdir -p ../docker-build/node_modules/@comp/integration-platform
7873
- cp -r ../../packages/integration-platform/dist ../docker-build/node_modules/@comp/integration-platform/
7974
- cp ../../packages/integration-platform/package.json ../docker-build/node_modules/@comp/integration-platform/
8075

0 commit comments

Comments
 (0)