| FROM node:22-bookworm-slim | |
| # The example build uses `bun build` (no fallback in the npm scripts); install it. | |
| RUN npm install -g bun@1.2.21 | |
| WORKDIR /app | |
| # Install deps first for better layer caching. Copied out of the ext-apps | |
| # monorepo, so the workspace is gone — @modelcontextprotocol/ext-apps and | |
| # /sdk resolve from the public npm registry. | |
| # | |
| # Use `bun install`, not `npm install`: with no lockfile, npm mis-resolves | |
| # rollup/vite's platform-specific optional deps and dies with EBADPLATFORM | |
| # (@rollup/rollup-win32-x64-msvc on Linux). bun resolves the correct platform | |
| # binaries, and it's already installed for the build below. | |
| COPY package.json ./ | |
| RUN bun install | |
| # Build: tsc typecheck -> vite single-file UI -> bun-bundled dist/index.js | |
| COPY . . | |
| RUN npm run build | |
| # HF Spaces route external HTTPS to app_port; the server reads PORT and binds | |
| # 0.0.0.0 (see main.ts). Keep PORT == app_port (7860) in the Space README. | |
| ENV PORT=7860 | |
| EXPOSE 7860 | |
| # Default (no --stdio) starts the Streamable HTTP transport at /mcp. | |
| CMD ["node", "dist/index.js"] | |