CognxSafeTrack commited on
Commit
e4884cd
·
1 Parent(s): 6bc380e

fix: resolve Docker build cache miss and pnpm filter errors

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -25
Dockerfile CHANGED
@@ -2,38 +2,24 @@ FROM node:18-alpine
2
 
3
  WORKDIR /app
4
 
5
- # Install pnpm and global dependencies
6
- RUN npm install -g pnpm turbo
7
 
8
- # Copy root package files
9
- COPY package.json pnpm-workspace.yaml turbo.json ./
 
 
 
10
 
11
- # Copy package configurations
12
- COPY packages/tsconfig packages/tsconfig
13
- COPY packages/database packages/database
14
- COPY packages/shared-types packages/shared-types
15
-
16
- # Copy app configurations
17
- COPY apps/api/package.json apps/api/package.json
18
- COPY apps/whatsapp-worker/package.json apps/whatsapp-worker/package.json
19
- COPY apps/api/tsconfig.json apps/api/tsconfig.json
20
- COPY apps/whatsapp-worker/tsconfig.json apps/whatsapp-worker/tsconfig.json
21
-
22
- # Install dependencies
23
  RUN pnpm install
24
 
25
- # Copy source code
26
- COPY packages/database packages/database
27
- COPY packages/shared-types packages/shared-types
28
- COPY apps/api apps/api
29
- COPY apps/whatsapp-worker apps/whatsapp-worker
30
- COPY scripts/start-backend.sh scripts/start-backend.sh
31
-
32
  # Generate Prisma Client
33
  RUN pnpm db:generate
34
 
35
- # Build packages and apps
36
- RUN pnpm build --filter=api --filter=whatsapp-worker...
 
37
 
38
  # Make script executable
39
  RUN chmod +x scripts/start-backend.sh
@@ -44,3 +30,4 @@ ENV PORT=7860
44
 
45
  # Start command
46
  CMD ["./scripts/start-backend.sh"]
 
 
2
 
3
  WORKDIR /app
4
 
5
+ # Install pnpm
6
+ RUN npm install -g pnpm
7
 
8
+ # Copy ALL workspace files first for a proper pnpm install
9
+ COPY package.json pnpm-workspace.yaml ./
10
+ COPY packages/ packages/
11
+ COPY apps/ apps/
12
+ COPY scripts/ scripts/
13
 
14
+ # Install all dependencies (this handles workspaces correctly)
 
 
 
 
 
 
 
 
 
 
 
15
  RUN pnpm install
16
 
 
 
 
 
 
 
 
17
  # Generate Prisma Client
18
  RUN pnpm db:generate
19
 
20
+ # Build the specific apps
21
+ RUN pnpm --filter api build
22
+ RUN pnpm --filter whatsapp-worker build
23
 
24
  # Make script executable
25
  RUN chmod +x scripts/start-backend.sh
 
30
 
31
  # Start command
32
  CMD ["./scripts/start-backend.sh"]
33
+