ChandimaPrabath commited on
Commit
e46f68d
1 Parent(s): 0454be9
Files changed (2) hide show
  1. Dockerfile +10 -7
  2. frontend/package.json +1 -1
Dockerfile CHANGED
@@ -14,19 +14,22 @@ RUN npm run build
14
  # Install PM2 globally
15
  RUN npm install -g pm2
16
 
17
- # Stage 2: Serve the Next.js application using PM2 and Nginx
18
- FROM bitnami/nginx:1.26.1
19
 
20
- # Copy custom Nginx configuration
21
- COPY nginx.conf /opt/bitnami/nginx/conf/nginx.conf
22
 
23
- # Copy the Next.js build from the builder stage
24
  COPY --from=builder /app /app
25
 
26
- WORKDIR /app
 
27
 
28
- # Expose the necessary port
29
  EXPOSE 7860
30
 
 
 
 
31
  # Start Next.js with PM2
32
  CMD ["pm2-runtime", "start", "npm", "--", "start"]
 
14
  # Install PM2 globally
15
  RUN npm install -g pm2
16
 
17
+ # Stage 2: Run the Next.js application with PM2
18
+ FROM node:20-alpine
19
 
20
+ WORKDIR /app
 
21
 
22
+ # Copy the Next.js build and node_modules from the builder stage
23
  COPY --from=builder /app /app
24
 
25
+ # Install PM2 globally
26
+ RUN npm install -g pm2
27
 
28
+ # Expose port 7860
29
  EXPOSE 7860
30
 
31
+ # Set the PORT environment variable
32
+ ENV PORT=7860
33
+
34
  # Start Next.js with PM2
35
  CMD ["pm2-runtime", "start", "npm", "--", "start"]
frontend/package.json CHANGED
@@ -5,7 +5,7 @@
5
  "scripts": {
6
  "dev": "next dev",
7
  "build": "next build",
8
- "start": "next start",
9
  "lint": "next lint"
10
  },
11
  "dependencies": {
 
5
  "scripts": {
6
  "dev": "next dev",
7
  "build": "next build",
8
+ "start": "PORT=7860 next start",
9
  "lint": "next lint"
10
  },
11
  "dependencies": {