handle restarts with docker instead of forever

This commit is contained in:
Ophir LOJKINE 2019-03-27 11:50:24 +01:00
parent 269c2d4b69
commit dd9a9bf59c
4 changed files with 130 additions and 2482 deletions

View file

@ -2,12 +2,15 @@ FROM node:10-alpine
WORKDIR /opt/app
COPY . /opt/app
ENV PORT=80
EXPOSE 80
VOLUME /opt/app/server-data
RUN touch /usr/bin/start.sh # this is the script which will run on start
RUN echo 'npm install --production' >> /usr/bin/start.sh
RUN echo 'npx forever --minUptime 7000 --spinSleepTime 2000 -o out.log -e err.log /opt/app/server/server.js' >> /usr/bin/start.sh
RUN echo 'node /opt/app/server/server.js' >> /usr/bin/start.sh
CMD ["/bin/sh","/usr/bin/start.sh"]

View file

@ -1,12 +1,17 @@
version: '3'
services:
www:
volumes:
- /opt/app/:/opt/app/
ports:
- '80:80'
build:
context: .
restart: on-failure
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 5
window: 60s

2595
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -6,7 +6,6 @@
"version": "1.0.22",
"license": "AGPL-3.0-or-later",
"dependencies": {
"forever": "^0.15.3",
"handlebars": "^4.1.1",
"node-static": "0.7.x",
"socket.io": "^2.2.0"
@ -24,6 +23,6 @@
"url": "http://github.com/lovasoa/whitebophir.git"
},
"devDependencies": {
"openode": "^1.9.0"
"openode": "^1.9.8"
}
}