Skip to content

Commit 05a645f

Browse files
authored
Mariano/integrations architecture (#1885)
* refactor(api): update Dockerfile and buildspec to streamline node_modules handling
1 parent 6086d45 commit 05a645f

3 files changed

Lines changed: 8 additions & 22 deletions

File tree

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: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -63,24 +63,18 @@ phases:
6363
- ls -la ../docker-build/src/
6464
- '[ -f "../docker-build/src/main.js" ] || { echo "❌ main.js not found in docker-build/src"; exit 1; }'
6565

66-
- mkdir -p ../docker-build/node_modules/@trycompai
67-
- mkdir -p ../docker-build/node_modules/@trycompai/utils
68-
- mkdir -p ../docker-build/node_modules/@trycompai/db
69-
- mkdir -p ../docker-build/node_modules/@comp
70-
- mkdir -p ../docker-build/node_modules/@comp/integration-platform
66+
# Copy ALL node_modules from root (already installed with production deps)
67+
- echo "Copying node_modules from root..."
68+
- cp -r ../../node_modules ../docker-build/
7169

70+
# Override workspace packages with built versions
7271
- cp -r ../../packages/utils/src ../docker-build/node_modules/@trycompai/utils/
7372
- cp ../../packages/utils/package.json ../docker-build/node_modules/@trycompai/utils/
74-
7573
- cp -r ../../packages/db/dist ../docker-build/node_modules/@trycompai/db/
7674
- cp ../../packages/db/package.json ../docker-build/node_modules/@trycompai/db/
77-
7875
- cp -r ../../packages/integration-platform/dist ../docker-build/node_modules/@comp/integration-platform/
7976
- cp ../../packages/integration-platform/package.json ../docker-build/node_modules/@comp/integration-platform/
8077

81-
- cp -r ../../node_modules/@prisma ../docker-build/node_modules/@prisma
82-
- cp -r ../../node_modules/.prisma ../docker-build/node_modules/.prisma
83-
8478
- cp Dockerfile ../docker-build/
8579

8680
# Modify package.json to remove workspace dependencies (they're copied manually)

apps/api/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"class-validator": "^0.14.2",
3434
"dotenv": "^17.2.3",
3535
"exceljs": "^4.4.0",
36+
"express": "^4.21.2",
3637
"helmet": "^8.1.0",
3738
"jose": "^6.0.12",
3839
"jspdf": "^3.0.3",

0 commit comments

Comments
 (0)