Преглед изворни кода

Added a entrypoint file so the node.js process is not the root process, so it responds to SIGINT calls (Ctrl+C).

Zachary Boyd пре 5 година
родитељ
комит
fbdbf525df
6 измењених фајлова са 15 додато и 5 уклоњено
  1. 4 0
      CHANGELOG.md
  2. 4 2
      Dockerfile
  3. 3 0
      docker-entrypoint.sh
  4. 2 2
      package-lock.json
  5. 1 1
      package.json
  6. 1 0
      src/launch.js

+ 4 - 0
CHANGELOG.md

@@ -1,5 +1,9 @@
 # Changelog
 # Changelog
 
 
+## [4.0.12] - 2019-11-21
+### Added
+- Added a entrypoint file so the node.js process is not the root process, so it responds to SIGINT calls (Ctrl+C).
+
 ## [4.0.11] - 2019-01-15
 ## [4.0.11] - 2019-01-15
 ### Changed
 ### Changed
 - Updates `multi-rpc` to version 1.5.5.
 - Updates `multi-rpc` to version 1.5.5.

+ 4 - 2
Dockerfile

@@ -20,7 +20,9 @@ USER tor_router
 
 
 ADD package.json /app/package.json
 ADD package.json /app/package.json
 
 
-RUN npm install 
+ADD package-lock.json /app/package-lock.json
+
+RUN npm ci 
 
 
 ADD . /app
 ADD . /app
 
 
@@ -28,6 +30,6 @@ ENV HOME /home/tor_router
 
 
 EXPOSE 9050 9053 9077
 EXPOSE 9050 9053 9077
 
 
-ENTRYPOINT [ "tor-router" ]
+ENTRYPOINT [ "/bin/bash", "/app/docker-entrypoint.sh" ]
 
 
 CMD [ "-s", "-d", "-j", "1" ]
 CMD [ "-s", "-d", "-j", "1" ]

+ 3 - 0
docker-entrypoint.sh

@@ -0,0 +1,3 @@
+#!/bin/bash
+
+/app/bin/tor-router $@

+ 2 - 2
package-lock.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "tor-router",
   "name": "tor-router",
-  "version": "4.0.10",
+  "version": "4.0.11",
   "lockfileVersion": 1,
   "lockfileVersion": 1,
   "requires": true,
   "requires": true,
   "dependencies": {
   "dependencies": {
@@ -1887,7 +1887,7 @@
       "from": "git+https://github.com/znetstar/node-dns.git#336f1d3027b2a3da719b5cd65380219267901aeb",
       "from": "git+https://github.com/znetstar/node-dns.git#336f1d3027b2a3da719b5cd65380219267901aeb",
       "requires": {
       "requires": {
         "ipaddr.js": "~0.1.3",
         "ipaddr.js": "~0.1.3",
-        "native-dns-cache": "git+https://github.com/znetstar/native-dns-cache.git#7743c19bd1b70d0ec32a364aadc77fbcfd5a67ad",
+        "native-dns-cache": "git+https://github.com/znetstar/native-dns-cache.git",
         "native-dns-packet": "~0.1.1"
         "native-dns-packet": "~0.1.1"
       }
       }
     },
     },

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "tor-router",
   "name": "tor-router",
-  "version": "4.0.11",
+  "version": "4.0.12",
   "main": "src/index.js",
   "main": "src/index.js",
   "repository": "git@github.com:znetstar/tor-router.git",
   "repository": "git@github.com:znetstar/tor-router.git",
   "author": "Zachary Boyd <zachary@zacharyboyd.nyc>",
   "author": "Zachary Boyd <zachary@zacharyboyd.nyc>",

+ 1 - 0
src/launch.js

@@ -148,6 +148,7 @@ async function main(nconf, logger) {
 
 
     process.on('exit', cleanUp);
     process.on('exit', cleanUp);
     process.on('SIGINT', cleanUp);
     process.on('SIGINT', cleanUp);
+    process.on('SIGTERM', cleanUp);
     process.on('uncaughtException', cleanUp.bind({ handleError: true }));
     process.on('uncaughtException', cleanUp.bind({ handleError: true }));
 }
 }