FROM --platform=linux/amd64 node:20-alpine # curl for health checks RUN apk add --no-cache curl WORKDIR /app COPY package*.json ./ RUN npm install --production --ignore-scripts COPY . . RUN npm run build RUN addgroup -g 1001 -S nodejs RUN adduser -S nestjs -u 1001 RUN chown -R nestjs:nodejs /app USER nestjs EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD curl -f http://localhost:3000/health || exit 1 CMD ["npm", "run", "start:prod"]