Docker
Dockerfile
dockerfile
FROM node:22-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
COPY dist ./dist
USER node
CMD ["node", "dist/index.js"]docker-compose
yaml
services:
app:
build: .
stop_grace_period: 45sDocker sends SIGTERM on docker stop. lastcall handles it automatically.
Best practices
- Use
STOPSIGNAL SIGTERM(Docker default) - Set
stop_grace_period> yourshutdownTimeoutMs - Register
withHttpServer()for any HTTP service - Use
critical: trueon database handlers
Health checks
During pre phase, mark your health endpoint unhealthy so the load balancer stops routing traffic before drain begins.