ChandimaPrabath commited on
Commit
d0e894b
1 Parent(s): cb363ec

fix Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +10 -8
Dockerfile CHANGED
@@ -17,20 +17,22 @@ RUN npm install -g pm2
17
  # Stage 2: Run the Next.js application with PM2
18
  FROM node:20-alpine
19
 
20
- # Working directory set to /tmp due to write permissions
21
- WORKDIR /tmp
 
22
 
23
  # Copy the Next.js build and node_modules from the builder stage
24
- COPY --from=builder /app /tmp
25
 
26
  # Install PM2 globally
27
  RUN npm install -g pm2
28
 
 
 
 
29
  # Expose port 7860
30
  EXPOSE 7860
31
 
32
- # Set the PORT environment variable
33
- ENV PORT=7860
34
-
35
- # Start Next.js with PM2
36
- CMD ["pm2-runtime", "start", "npm", "--", "start"]
 
17
  # Stage 2: Run the Next.js application with PM2
18
  FROM node:20-alpine
19
 
20
+ # Create necessary directories with write permissions
21
+ WORKDIR /app
22
+ RUN mkdir -p /tmp/.next/cache/images && chown -R node:node /tmp
23
 
24
  # Copy the Next.js build and node_modules from the builder stage
25
+ COPY --from=builder /app /app
26
 
27
  # Install PM2 globally
28
  RUN npm install -g pm2
29
 
30
+ # Set environment variables
31
+ ENV PORT=7860
32
+
33
  # Expose port 7860
34
  EXPOSE 7860
35
 
36
+ # Run the application with PM2
37
+ USER node
38
+ CMD ["pm2-runtime", "start", "npm", "--", "start"]