Skip to content

Commit

Permalink
build(docker): use nodejs instead of pm2
Browse files Browse the repository at this point in the history
- Update node.js version to 18
- Update nvm to v0.39.7
- Use node to run project
  • Loading branch information
Chinlinlee committed Mar 1, 2024
1 parent 2fdfc3a commit 54d8631
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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" ]
CMD [ "node", "server.js" ]
4 changes: 2 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -40,5 +40,5 @@ services:
depends_on:
- mongodb
tty : true
restart: on-failure:3
restart: unless-stopped
stdin_open : true

0 comments on commit 54d8631

Please sign in to comment.