Next.js Discord

Discord Forum

PM2-runtime and with max instance.

Unanswered
Chinese Alligator posted this in #help-forum
Open in Discord
Chinese AlligatorOP
Hi there,
Can anyone guide me to configure PM2 with docker.
I have tried it but it not working for me. below are file configuration.

DockerFile :
FROM node:18-alpine


WORKDIR /app

RUN npm install --global pm2


COPY . /app
RUN npm install --f

RUN npm run build

EXPOSE 3000


CMD ["pm2-runtime", "ecosystem.config.js"]


ecosystem.config.js

module.exports = {
apps: [
{
name: "nextjs-app",
script: "npm",
args: "run start",
instances: "max",
autorestart: false,
watch: false
},
],
};

Command : pm2-runtime start ecosystem.config.js

0 Replies