feat: switch foundry backend from Bun to Node.js

- Replace Bun.serve() with @hono/node-server (already a dependency)
- Replace Bun-specific debug APIs (Bun.gc, Bun.heapStats,
  Bun.generateHeapSnapshot) with Node.js equivalents (globalThis.gc)
- Update all three Dockerfiles from oven/bun base images to
  node:22-bookworm-slim
- Remove @types/bun devDependency
- Update package.json scripts to use node/npx instead of bun

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Nathan Flurry 2026-03-22 04:46:52 -07:00
parent 62d56fae64
commit bc872da6f2
6 changed files with 37 additions and 86 deletions

View file

@ -16,7 +16,7 @@ RUN SKIP_OPENAPI_GEN=1 pnpm --filter sandbox-agent build
RUN pnpm --filter @sandbox-agent/foundry-backend build
RUN pnpm --filter @sandbox-agent/foundry-backend deploy --prod /out
FROM oven/bun:1.2 AS runtime
FROM node:22-bookworm-slim AS runtime
ENV NODE_ENV=production
ENV HOME=/home/task
ENV RIVET_RUNNER_VERSION_FILE=/etc/foundry/rivet-runner-version
@ -37,4 +37,4 @@ RUN mkdir -p /etc/foundry \
COPY --from=build /out ./
USER task
EXPOSE 7741
CMD ["bun", "dist/index.js", "start", "--host", "0.0.0.0"]
CMD ["node", "dist/index.js", "start", "--host", "0.0.0.0"]

View file

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.7
FROM oven/bun:1.3
FROM node:22-bookworm-slim
ARG SANDBOX_AGENT_VERSION=0.3.0
@ -10,8 +10,6 @@ RUN apt-get update \
curl \
git \
gh \
nodejs \
npm \
openssh-client \
&& rm -rf /var/lib/apt/lists/*
@ -27,8 +25,4 @@ RUN mkdir -p /etc/foundry \
WORKDIR /app
# NOTE: Do NOT use `bun --hot` here. Bun's hot reloading re-initializes the
# server on a new port (e.g. 6421 instead of 6420) while the container still
# exposes the original port, breaking all client connections. Restart the
# backend container instead: `just foundry-dev-down && just foundry-dev`
CMD ["bash", "-lc", "git config --global --add safe.directory /app >/dev/null 2>&1 || true; pnpm install --frozen-lockfile --filter @sandbox-agent/foundry-backend... && exec bun foundry/packages/backend/src/index.ts start --host 0.0.0.0 --port 7741"]
CMD ["bash", "-lc", "git config --global --add safe.directory /app >/dev/null 2>&1 || true; pnpm install --frozen-lockfile --filter @sandbox-agent/foundry-backend... && pnpm --filter @sandbox-agent/foundry-shared build && pnpm --filter @sandbox-agent/foundry-backend build && exec node foundry/packages/backend/dist/index.js start --host 0.0.0.0 --port 7741"]

View file

@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1.7
FROM oven/bun:1.3
FROM node:22-bookworm-slim
ARG SANDBOX_AGENT_VERSION=0.3.0
@ -10,8 +10,6 @@ RUN apt-get update \
curl \
git \
gh \
nodejs \
npm \
openssh-client \
&& npm install -g pnpm@10.28.2 \
&& rm -rf /var/lib/apt/lists/*
@ -33,4 +31,4 @@ RUN pnpm --filter @sandbox-agent/foundry-shared build
RUN pnpm --filter @sandbox-agent/foundry-client build
RUN pnpm --filter @sandbox-agent/foundry-backend build
CMD ["bash", "-lc", "git config --global --add safe.directory /workspace/quebec >/dev/null 2>&1 || true; exec bun packages/backend/dist/index.js start --host 0.0.0.0 --port 7841"]
CMD ["bash", "-lc", "git config --global --add safe.directory /workspace/quebec >/dev/null 2>&1 || true; exec node packages/backend/dist/index.js start --host 0.0.0.0 --port 7841"]