FROM node:22-slim RUN apt-get update && apt-get install -y --no-install-recommends libgl1 \ && rm -rf /var/lib/apt/lists/* WORKDIR /app RUN chown node:node /app USER node ENV PATH="/home/node/.local/bin:$PATH" COPY --chown=node package*.json ./ # Install dev deps so Nest CLI is available during build (even if NODE_ENV=production is set externally) RUN npm ci --include=dev COPY --chown=node . /app RUN npm run build # Trim dev dependencies for the runtime image RUN npm prune --omit=dev ENV NODE_ENV=production ENV PORT=7860 EXPOSE 7860 CMD ["node", "dist/main.js"]