diff --git a/packages/next/build/utils.ts b/packages/next/build/utils.ts index 00c8d9ece3180..e1c8adf323c37 100644 --- a/packages/next/build/utils.ts +++ b/packages/next/build/utils.ts @@ -1233,6 +1233,10 @@ const NextServer = require('next/dist/server/next-server').default const http = require('http') const path = require('path') +// Make sure commands gracefully respect termination signals (e.g. from Docker) +process.on('SIGTERM', () => process.exit(0)) +process.on('SIGINT', () => process.exit(0)) + let handler const server = http.createServer(async (req, res) => {