Bibhu Mishra commited on
Commit
ca41e99
·
1 Parent(s): 97dab2a

Fixed docker file

Browse files
Files changed (1) hide show
  1. Dockerfile +19 -8
Dockerfile CHANGED
@@ -4,20 +4,31 @@ FROM node:20-alpine AS builder
4
  # Set working directory
5
  WORKDIR /app
6
 
7
- # Install dependencies
 
 
 
8
  COPY package*.json ./
9
- RUN npm install
10
 
11
- # Copy the rest of the app's source code
 
 
 
 
12
  COPY . .
13
 
14
  # Build the NestJS app
15
- RUN npm run build:apigateway
 
16
 
17
- RUN mkdir -p dist/libs/proto && cp -r libs/proto dist/libs
 
 
18
 
19
- # Start the application
20
- CMD ["node", "dist/apps/apigateway/main.js"]
 
21
 
22
- # Expose app port
23
  EXPOSE 8080
 
 
4
  # Set working directory
5
  WORKDIR /app
6
 
7
+ # Install build tools for native dependencies
8
+ RUN apk add --no-cache python3 make g++
9
+
10
+ # Copy package.json and package-lock.json first for caching
11
  COPY package*.json ./
 
12
 
13
+ # Install dependencies with verbose logging
14
+ RUN echo "Installing dependencies..." \
15
+ && npm install --verbose
16
+
17
+ # Copy the rest of the app source code
18
  COPY . .
19
 
20
  # Build the NestJS app
21
+ RUN echo "Building NestJS API Gateway..." \
22
+ && npm run build:apigateway --verbose
23
 
24
+ # Ensure libs/proto folder is copied into dist for runtime
25
+ RUN mkdir -p dist/libs/proto \
26
+ && cp -r libs/proto dist/libs/
27
 
28
+ # Verify files in dist
29
+ RUN echo "Contents of dist folder:" \
30
+ && ls -lR dist
31
 
32
+ # Expose port 8080 and start the application
33
  EXPOSE 8080
34
+ CMD ["node", "dist/apps/apigateway/main.js"]