From c38f40158be80cee259e137844559bfe0b22c8b3 Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Mon, 7 Nov 2022 21:35:16 -0600 Subject: [PATCH] add healthcheck and fix shutdown order --- Dockerfile | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9477d4e..3ad4b19 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,5 @@ RUN npm run build # entry WORKDIR /usr/src/guppe EXPOSE 443 80 +HEALTHCHECK CMD /usr/bin/curl --fail http://localhost/ || exit 1 CMD [ "node", "index.js" ] diff --git a/index.js b/index.js index 5eb404a..98b1360 100644 --- a/index.js +++ b/index.js @@ -225,10 +225,10 @@ client.connect() console.log('Guppe server listening on port ' + PORT_HTTPS) }) onShutdown(async () => { - await client.close() await new Promise((resolve, reject) => { server.close(err => (err ? reject(err) : resolve())) }) + await client.close() console.log('Guppe server closed') }) })