Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
v0.0.2: docker handles SIGTERM
Browse files Browse the repository at this point in the history
  • Loading branch information
CorySanin committed Sep 6, 2023
1 parent 681b1e0 commit a0f7273
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ COPY --from=install /usr/src/app /usr/src/app/

USER node

CMD [ "npm", "start" ]
CMD [ "node", "index.js" ]
13 changes: 8 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ function runCommand(command, args = []) {
});
}

function shutdown() {
console.log('\nShutting down...');
servers.forEach(serv => {
serv.close();
});
}

(async () => {
try {
Expand Down Expand Up @@ -135,8 +141,5 @@ function runCommand(command, args = []) {

servers.push(app.listen(config.unsecPort, () => console.log(`static-cs2-portraits listening on port ${config.unsecPort}!`)));

process.on('SIGTERM', () => {
servers.forEach(serv => {
serv.close();
});
});
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "static-cs2-portraits",
"version": "0.0.1",
"version": "0.0.2",
"description": "I'm not looking at animated profile pictures in my competitive shooter.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a0f7273

Please sign in to comment.