Skip to content

Commit

Permalink
feat: use PM2 in Dockerfile
Browse files Browse the repository at this point in the history
As a temporary mitigation for nodejs/node#39671.
  • Loading branch information
thebengeu committed Mar 16, 2022
1 parent 1e55aa3 commit 86ad3b7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ RUN npm ci
RUN npm run build

FROM node:14-alpine
RUN npm install -g pm2
WORKDIR /app
COPY migrations migrations
COPY package.json .
COPY ecosystem.config.js package.json .
COPY --from=0 /app/node_modules node_modules
COPY --from=1 /app/dist dist
EXPOSE 5000
CMD ["npm", "run", "start"]
CMD ["pm2-runtime", "ecosystem.config.js"]
11 changes: 11 additions & 0 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = {
apps: [
{
env: {
NODE_ENV: 'production',
},
exp_backoff_restart_delay: 100,
script: 'dist/server.js',
},
],
}

0 comments on commit 86ad3b7

Please sign in to comment.