Good Code
The good version uses exec form, so the application process receives termination signals directly.
Lesson 08
Use exec-form commands and keep startup wrappers signal-safe so containers stop gracefully.
FROM node:22-alpine
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm ci --omit=dev
COPY server.js ./server.js
ENTRYPOINT ["node"]
CMD ["server.js"]FROM node:22-alpine
WORKDIR /app
COPY . .
RUN npm install
CMD npm startThe good version uses exec form, so the application process receives termination signals directly.
The bad version uses shell form. The shell can become PID 1 and make signal forwarding and graceful shutdown less predictable.