瀏覽代碼

Restart the server automatically when it fails

dev_h
Ophir LOJKINE 6 年之前
父節點
當前提交
87372e4f79
共有 3 個檔案被更改,包括 2468 行新增124 行删除
  1. 1
    17
      Dockerfile
  2. 2466
    107
      package-lock.json
  3. 1
    0
      package.json

+ 1
- 17
Dockerfile 查看文件

7
 
7
 
8
 RUN touch /usr/bin/start.sh # this is the script which will run on start
8
 RUN touch /usr/bin/start.sh # this is the script which will run on start
9
 
9
 
10
-# if you need a build script, uncomment the line below
11
-# RUN echo 'sh mybuild.sh' >> /usr/bin/start.sh
12
-
13
-# if you need redis, uncomment the lines below
14
-# RUN apk --update add redis
15
-# RUN echo 'redis-server &' >> /usr/bin/start.sh
16
-
17
-# daemon for cron jobs
18
-# RUN echo 'echo will install crond...' >> /usr/bin/start.sh
19
-# RUN echo 'crond' >> /usr/bin/start.sh
20
-
21
-# Basic npm start verification
22
-RUN echo 'nb=`cat package.json | grep start | wc -l` && if test "$nb" = "0" ; then echo "*** Boot issue: No start command found in your package.json in the scripts. See https://docs.npmjs.com/cli/start" ; exit 1 ; fi' >> /usr/bin/start.sh
23
-
24
 RUN echo 'npm install --production' >> /usr/bin/start.sh
10
 RUN echo 'npm install --production' >> /usr/bin/start.sh
25
-
26
-# npm start, make sure to have a start attribute in "scripts" in package.json
27
-RUN echo 'npm start' >> /usr/bin/start.sh
11
+RUN echo 'npx forever --minUptime 7000 --spinSleepTime 2000 -o out.log -e err.log ./server/server.js' >> /usr/bin/start.sh
28
 
12
 
29
 CMD ["/bin/sh","/usr/bin/start.sh"]
13
 CMD ["/bin/sh","/usr/bin/start.sh"]

+ 2466
- 107
package-lock.json
文件差異過大導致無法顯示
查看文件


+ 1
- 0
package.json 查看文件

6
    "version": "1.0.22",
6
    "version": "1.0.22",
7
    "license": "AGPL-3.0-or-later",
7
    "license": "AGPL-3.0-or-later",
8
    "dependencies": {
8
    "dependencies": {
9
+      "forever": "^0.15.3",
9
       "handlebars": "^4.1.1",
10
       "handlebars": "^4.1.1",
10
       "node-static": "0.7.x",
11
       "node-static": "0.7.x",
11
       "socket.io": "^2.2.0"
12
       "socket.io": "^2.2.0"

Loading…
取消
儲存