Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(docker): force devDependencies in builder stage (nest: not found)
MS-Jahanf848426cb44b
diff --git a/Dockerfile b/Dockerfileindex 5329c553c..53d70a100 100644--- a/Dockerfile+++ b/Dockerfile@@ -23,8 +23,14 @@ RUN apt-get update && apt-get install -y \# Copy package filesCOPY package*.json ./-# Install all dependencies (including devDependencies for build)-RUN npm ci+# Install all dependencies INCLUDING devDependencies — the build needs them (`nest` from+# @nestjs/cli, plus `vite`/`typescript` for the dashboard). `--include=dev` is REQUIRED, not+# cosmetic: npm omits devDependencies whenever NODE_ENV=production is present in the build env.+# Coolify (and similar PaaS) promote every ${VAR} referenced in the compose file to a build-time+# variable, so docker-compose.yml's `NODE_ENV=${NODE_ENV:-production}` leaks NODE_ENV=production+# into this stage and a bare `npm ci` would skip @nestjs/cli → `sh: 1: nest: not found` (exit 127).+# (docker-compose.dev.yml hardcodes NODE_ENV=development, which is why the dev build never hit this.)+RUN npm ci --include=dev# Copy source codeCOPY . .@@ -32,7 +38,9 @@ COPY . .# Build the API (dist/) and the dashboard SPA (dashboard/dist/). The root `npm ci` above# ran before the dashboard source was copied, so its postinstall hook skipped the dashboard# deps - install them explicitly here (npm ci, reproducible from dashboard/package-lock.json).-RUN npm run build && npm run dashboard:ci && npm run dashboard:build+# `--include=dev` for the same reason as above: the dashboard build needs vite/typescript+# (devDependencies), which a NODE_ENV=production build env would otherwise omit.+RUN npm run build && npm run dashboard:ci -- --include=dev && npm run dashboard:build# ===== Stage 2: Production =====FROM docker.io/node:22-slim AS production