CognxSafeTrack
fix(ai): remove double day incrementation on success and queue remediation correctly
8fde072 | FROM node:20-bookworm-slim | |
| WORKDIR /app | |
| # Set Puppeteer vars to skip direct download and use system Chromium | |
| ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true | |
| ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium | |
| # Install System dependencies: Chromium (for Puppeteer), OpenSSL (for Prisma), and CA certs | |
| RUN apt-get update && apt-get install -y \ | |
| chromium \ | |
| openssl \ | |
| ca-certificates \ | |
| curl \ | |
| --no-install-recommends && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Install pnpm (Pinned to v9 to avoid ERR_INVALID_THIS fetch bug on Node 20) and Typescript | |
| RUN npm install -g pnpm@9 typescript tsx | |
| # Copy ALL workspace files first for a proper pnpm install | |
| COPY package.json pnpm-workspace.yaml ./ | |
| COPY packages/ packages/ | |
| COPY apps/ apps/ | |
| COPY scripts/ scripts/ | |
| # Install all dependencies | |
| RUN pnpm install | |
| # Generate Prisma Client | |
| RUN pnpm --filter @repo/database generate | |
| # Give Node more memory and force IPv4 DNS resolution (fixes ENOTFOUND in native fetch) | |
| ENV NODE_OPTIONS="--max-old-space-size=2048 --dns-result-order=ipv4first" | |
| # Build all packages and apps to ensure dist folders are populated | |
| RUN pnpm -r build | |
| # Expose port (HF Spaces uses 7860) | |
| EXPOSE 7860 | |
| ENV PORT=7860 | |
| # Force Docker cache invalidation - bump date to trigger clean rebuild | |
| ENV REBUILD_DATE="2026-03-01-v14-fix-day-increment" | |
| # SAFETY: Default to skipping DB push to prevent schema drift. | |
| # Only Railway (api service) should push schema — it overrides SKIP_DB_PUSH=false in its variables. | |
| # HF Space (gateway) MUST NOT push — it would drop columns added by Railway migrations. | |
| ENV SKIP_DB_PUSH=true | |
| # Sync DB schema only if DATABASE_URL is present and NOT on a gateway-only light node | |
| CMD ["sh", "-c", "if [ -n \"$DATABASE_URL\" ] && [ \"$SKIP_DB_PUSH\" != \"true\" ]; then echo '[STARTUP] Syncing DB schema...'; pnpm --filter @repo/database db:push --accept-data-loss; else echo '[STARTUP] Skipping DB Push (SKIP_DB_PUSH=true or no DATABASE_URL)'; fi && tsx apps/api/src/index.ts"] | |