# AppForge — single-service production image # Builds the Vite frontend and runs the Express backend, which serves both the # API (/api), uploaded files (/storage), and the built frontend (SPA). FROM node:22-bookworm-slim WORKDIR /app # System deps occasionally needed by build tooling RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates \ && rm -rf /var/lib/apt/lists/* # Install dependencies (full install — tsx/vite are needed for build & runtime) # --include=dev: build needs vite/tsx (devDeps); Coolify sets NODE_ENV=production # during build which would otherwise skip them. COPY package.json package-lock.json .npmrc ./ RUN npm ci --include=dev --legacy-peer-deps # Copy source and build the frontend COPY . . RUN npm run build ENV NODE_ENV=production ENV PORT=3000 EXPOSE 3000 # The server applies the DB schema on boot (idempotent) and serves everything CMD ["npm", "run", "start"]