Merge pull request #4343 from anvme/fix/docker-exec-server-single-process
Run server as PID 1 in Docker to drop idle launcher processes. -30% RAM Usage
This commit is contained in:
2 files changed
+17
-1
No files matched your search
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
# Container startup: run the one-shot DB check/migration and tracker update, then
|
||||
# exec the long-running server so it replaces this shell as PID 1.
|
||||
#
|
||||
# This avoids `npm-run-all` keeping idle `npm`/`npm-run-all` parent processes
|
||||
# resident for the lifetime of the container (each a full Node VM holding tens
|
||||
# of MiB of anonymous memory). `exec` leaves a single `node server.js` process.
|
||||
#
|
||||
# PATH is extended so check-db.js's `prisma migrate deploy` resolves the prisma
|
||||
# CLI from node_modules/.bin the way `npm run` would have injected it.
|
||||
set -e
|
||||
export PATH="$PWD/node_modules/.bin:$PATH"
|
||||
|
||||
node scripts/check-db.js
|
||||
node scripts/update-tracker.js
|
||||
exec node server.js
|
||||
Reference in new issue
Block a user