diff --git a/dockerfile b/dockerfile index 0388d4bcb..923d8b10a 100644 --- a/dockerfile +++ b/dockerfile @@ -31,6 +31,7 @@ RUN npm run build EXPOSE 3001 VOLUME ["/app/data"] +HEALTHCHECK --interval=5s --timeout=3s --start-period=30s CMD node extra/healthcheck.js CMD ["npm", "run", "start-server"] FROM release AS nightly diff --git a/extra/healthcheck.js b/extra/healthcheck.js new file mode 100644 index 000000000..b547fbcba --- /dev/null +++ b/extra/healthcheck.js @@ -0,0 +1,19 @@ +var http = require("http"); +var options = { + host: "localhost", + port: "3001", + timeout: 2000, +}; +var request = http.request(options, (res) => { + console.log(`STATUS: ${res.statusCode}`); + if (res.statusCode == 200) { + process.exit(0); + } else { + process.exit(1); + } +}); +request.on("error", function (err) { + console.log("ERROR"); + process.exit(1); +}); +request.end();