nestjs-deployment
Installation
SKILL.md
Deployment & Ops Standards
Priority: P1 (OPERATIONAL)
Workflow: Containerize NestJS App
- Write multi-stage Dockerfile — Build stage installs devDeps and runs
nest build; run stage copies onlydistand prunednode_modules. - Set non-root user — Add
USER nodeto Dockerfile. - Tune memory — Set
--max-old-space-sizeto ~75% of container memory limit. - Enable shutdown hooks — Call
app.enableShutdownHooks()inmain.ts. - Add K8s pre-stop — Configure 5-10s sleep pre-stop hook for LB draining.