Skip to content

Commit 29e62ea

Browse files
authored
feat: use PM2 in Dockerfile (#123)
1 parent 1e55aa3 commit 29e62ea

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ RUN npm ci
1212
RUN npm run build
1313

1414
FROM node:14-alpine
15+
RUN npm install -g pm2
1516
WORKDIR /app
1617
COPY migrations migrations
17-
COPY package.json .
18+
COPY ecosystem.config.js package.json .
1819
COPY --from=0 /app/node_modules node_modules
1920
COPY --from=1 /app/dist dist
2021
EXPOSE 5000
21-
CMD ["npm", "run", "start"]
22+
CMD ["pm2-runtime", "ecosystem.config.js"]

ecosystem.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module.exports = {
2+
apps: [
3+
{
4+
env: {
5+
NODE_ENV: 'production',
6+
},
7+
script: 'dist/server.js',
8+
},
9+
],
10+
}

0 commit comments

Comments
 (0)