From 54d8631e5d5d14ff0434fc09840db7e737525e43 Mon Sep 17 00:00:00 2001 From: "CHIN\\a5566" Date: Fri, 1 Mar 2024 13:27:00 +0800 Subject: [PATCH] build(docker): use nodejs instead of pm2 - Update node.js version to 18 - Update nvm to v0.39.7 - Use node to run project --- Dockerfile | 9 +++------ docker-compose.yaml | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17f96c6b..0b11dacb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,11 @@ FROM eclipse-temurin:17-jdk-jammy # replace shell with bash so we can source files RUN rm /bin/sh && ln -s /bin/bash /bin/sh -ENV NODE_VERSION 16.20.0 +ENV NODE_VERSION 18.19.1 # Installing Node SHELL ["/bin/bash", "--login", "-i", "-c"] -RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash +RUN wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash RUN source /root/.bashrc && nvm install $NODE_VERSION RUN n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; cp -r $n/{bin,lib,share} /usr/local SHELL ["/bin/bash", "--login", "-c"] @@ -28,9 +28,6 @@ RUN mv /nodejs/raccoon/models/DICOM/dcm4che/javaNode/dcm4chee/lib/linux-x86-64/* # Install raccoon dependencies ENV NPM_CONFIG_LOGLEVEL warn ENV NODE_ENV production -ENV DCMDICTPATH=/nodejs/raccoon/models/DICOM/dcmtk/dicom.dic -RUN npm install pm2@latest -g -RUN npm install -g npm@9 RUN npm install --unsafe-perm --only=production -CMD [ "pm2-runtime", "start", "ecosystem.config.js" ] \ No newline at end of file +CMD [ "node", "server.js" ] \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 59dd91db..d4e4311b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -28,7 +28,7 @@ services: done; echo "db is ready!"; npm install; - pm2-runtime start ecosystem.config.js --node-args="--max-old-space-size=4096"; + node --max-old-space-size=4096 server.js; ' volumes : - ./:/nodejs/raccoon @@ -40,5 +40,5 @@ services: depends_on: - mongodb tty : true - restart: on-failure:3 + restart: unless-stopped stdin_open : true