From ead8fb8684c0ea2c2e7d87e13eeab8ec27cf0ac5 Mon Sep 17 00:00:00 2001 From: Carlos Escalante Date: Wed, 29 Apr 2026 22:21:45 -0600 Subject: [PATCH] Fix prod frontend container: tsx on PATH and cap build heap Runner stage was invoking `tsx server.ts` via sh, which doesn't have node_modules/.bin on PATH, so the container crash-looped with "tsx: not found" (502 at the edge). Use the absolute binary path instead. Also caps the Vite build's V8 heap to 1.5 GB so a future build on the 4-core / 8 GB VPS can't OOM-kill neighbouring services. Co-Authored-By: Claude Opus 4.7 (1M context) --- frontend/Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/Dockerfile b/frontend/Dockerfile index dd7a52c..4d231be 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -21,6 +21,8 @@ FROM node:22-alpine AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . +# Cap node heap so a build on a small VPS can't OOM-kill neighbours. +ENV NODE_OPTIONS=--max-old-space-size=1536 RUN corepack enable && pnpm build # Production: Hono serves dist/ + /api/copilotkit on port 3000 @@ -34,4 +36,4 @@ COPY server.ts package.json ./ EXPOSE 3000 HEALTHCHECK --interval=30s --timeout=3s --retries=3 \ CMD wget -qO- http://127.0.0.1:3000/api/health || exit 1 -CMD ["sh", "-c", "corepack enable && tsx server.ts"] +CMD ["./node_modules/.bin/tsx", "server.ts"]