k-l-lambda Claude commited on
Commit
ba018b4
·
1 Parent(s): aa55d85

Install backend deps at root level to avoid nested npm issue

Browse files

Copy backend package.json to root and install there.
This avoids the nested directory npm install which was failing.

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. Dockerfile +13 -30
Dockerfile CHANGED
@@ -2,52 +2,35 @@ FROM node:20-slim
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
- # Build timestamp: 2026-01-13T00:15
6
 
7
- # Minimal test - just check if files exist
8
  WORKDIR /app
9
 
10
- # Create directories explicitly
11
- RUN mkdir -p backend
12
-
13
- # Test COPY commands one by one
14
- RUN echo "Step 1: Working directory set"
15
-
16
- COPY trigo-web/package.json ./package.json
17
- RUN echo "Step 2: Root package.json copied" && cat package.json | head -5
18
-
19
- COPY trigo-web/backend/package.json ./backend/package.json
20
- RUN echo "Step 3: Backend package.json copied" && ls -la backend/ && cat backend/package.json | head -10
21
-
22
- # Install only esbuild (smaller than yarn)
23
  RUN npm install -g esbuild
24
- RUN echo "Step 4: esbuild installed"
25
 
26
- # Install root deps - this is simple, only dotenv
 
 
27
  RUN npm install --omit=dev
28
- RUN echo "Step 5: Root deps installed"
29
-
30
- # Install backend deps - try with --ignore-scripts
31
- RUN echo "Step 6: Starting backend npm install..." && \
32
- cd backend && \
33
- npm install --omit=dev --ignore-scripts 2>&1 && \
34
- echo "Step 6: Backend deps installed successfully" || \
35
- (echo "Step 6: Backend npm install FAILED" && exit 1)
36
 
37
  # Copy backend source
 
38
  COPY trigo-web/backend/src/ ./backend/src/
39
- RUN echo "Step 7: Backend source copied"
40
 
41
- # Build backend
42
  RUN mkdir -p backend/dist/backend/src && \
43
  esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm \
44
  --outfile=backend/dist/backend/src/server.js \
45
  --external:express --external:socket.io --external:cors --external:dotenv --external:uuid
46
- RUN echo "Step 8: Backend built"
47
 
48
  # Copy pre-built frontend
 
49
  COPY trigo-web/app/dist/ ./app/dist/
50
- RUN echo "Step 9: Frontend dist copied" && ls -la app/dist/
51
 
52
  # Copy public and other files
53
  COPY trigo-web/public/ ./public/
@@ -55,7 +38,7 @@ COPY trigo-web/.env ./.env
55
  COPY trigo-web/backend/.env ./backend/.env
56
  COPY trigo-web/backend/.env.local ./backend/.env.local
57
  COPY trigo-web/inc/ ./inc/
58
- RUN echo "Step 10: All files copied"
59
 
60
  ENV PORT=7860
61
  ENV HOST=0.0.0.0
 
2
 
3
  ENV DEBIAN_FRONTEND=noninteractive
4
 
5
+ # Build timestamp: 2026-01-13T00:20
6
 
 
7
  WORKDIR /app
8
 
9
+ # Install esbuild globally
 
 
 
 
 
 
 
 
 
 
 
 
10
  RUN npm install -g esbuild
 
11
 
12
+ # Copy only the backend package.json and install backend deps at root level
13
+ # This avoids the nested npm install issue
14
+ COPY trigo-web/backend/package.json ./package.json
15
  RUN npm install --omit=dev
16
+ RUN echo "Step 1: Dependencies installed" && ls -la node_modules/ | head -10
 
 
 
 
 
 
 
17
 
18
  # Copy backend source
19
+ RUN mkdir -p backend
20
  COPY trigo-web/backend/src/ ./backend/src/
21
+ RUN echo "Step 2: Backend source copied"
22
 
23
+ # Build backend with esbuild
24
  RUN mkdir -p backend/dist/backend/src && \
25
  esbuild backend/src/server.ts --bundle --platform=node --target=node20 --format=esm \
26
  --outfile=backend/dist/backend/src/server.js \
27
  --external:express --external:socket.io --external:cors --external:dotenv --external:uuid
28
+ RUN echo "Step 3: Backend built"
29
 
30
  # Copy pre-built frontend
31
+ RUN mkdir -p app
32
  COPY trigo-web/app/dist/ ./app/dist/
33
+ RUN echo "Step 4: Frontend copied" && ls -la app/dist/
34
 
35
  # Copy public and other files
36
  COPY trigo-web/public/ ./public/
 
38
  COPY trigo-web/backend/.env ./backend/.env
39
  COPY trigo-web/backend/.env.local ./backend/.env.local
40
  COPY trigo-web/inc/ ./inc/
41
+ RUN echo "Step 5: All files copied"
42
 
43
  ENV PORT=7860
44
  ENV HOST=0.0.0.0