From 0f8572fe01017b8c2aba70bf3a4a5b22561b948f Mon Sep 17 00:00:00 2001 From: tdurieux Date: Tue, 7 Sep 2021 08:39:15 +0200 Subject: [PATCH] chore: uses pm2 to start Anonymous GitHub in docker --- Dockerfile | 7 ++++++- docker-compose.yml | 1 - ecosystem.config.js | 13 +++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 ecosystem.config.js diff --git a/Dockerfile b/Dockerfile index e5e59b7..4378330 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,13 +5,18 @@ EXPOSE $PORT WORKDIR /app +RUN npm install pm2 -g +RUN pm2 install typescript + COPY package.json . COPY package-lock.json . RUN npm install +COPY ecosystem.config.js . +COPY healthcheck.js . COPY src . COPY index.ts . COPY public . -CMD [ "npm", "run", "start" ] \ No newline at end of file +CMD [ "pm2-runtime", "ecosystem.config.js"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 831d336..db23212 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,7 +4,6 @@ services: anonymous_github: build: . restart: always - command: nodemon --transpile-only index.ts image: tdurieux/anonymous_github:v2 env_file: - ./.env diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..5dd28a8 --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,13 @@ +module.exports = { + apps: [ + { + name: "AnonymousGitHub", + script: "./index.ts", + exec_mode: "fork", + watch: true, + interpreter: "node", + interpreter_args: + "--require ts-node/register", + }, + ], +};