Repository navigation
Conversation
…dgets Split the image build so core, browser, and cli each ship only the workspaces and production dependencies that service runs. node-pty loads lazily from the CLI host, so the core image can import the CLI host client without the native module. Fixes oll4com#64 Signed-off-by: Dayton Allen <daytonballen@gmail.com> Co-authored-by: dayton536 <dayton536@users.noreply.github.com>
| "fetch('http://127.0.0.1:4911/readyz').then(async r=>{const b=await r.json();if(!r.ok||b.ok!==true)process.exit(1)}).catch(()=>process.exit(1))"; | ||
|
|
||
| function socketProbe(socketPath) { | ||
| return `import('node:net').then(({createConnection})=>{const s=createConnection(${JSON.stringify(socketPath)},()=>{s.end();process.exit(0)});s.on('error',()=>process.exit(1))})`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes oll4com#64
Problem and user impact
runtime-basecopied the whole monorepo runtime (node_modules,apps,packages, agent skills, and owner scripts) into every image.coretherefore shippednode-pty, andbrowserandclishipped the API, the web app, the Temporal native bridge, and other packages those processes never start. Image size budgets sat at 1150 / 1750 / 2800 MiB.Change
The build stage now runs
deploy/docker/stage-container-runtime.mjsand writes/app-targets/{core,browser,cli}. Each target copies only that tree.coregets the API, worker, and web server, the runtime@space/*workspace packages they import, agent skills, owner and backup scripts, database migrations, and the production dependency closure.node-ptyis excluded.browsergetsbrowser-host-main.js, the local modules it imports, the@space/*packages on that graph, and their production dependencies, including database migrations.cligets@space/cli-host, agent skills, andnode-ptywith the Linux native build for the image architecture. Darwin, Windows, and musl prebuilds and the Windowsconptysources are dropped.node-ptyloads lazily inside@space/cli-host(createRequire) and is no longer a dependency of@space/api, so core can import the CLI host client without the native module.runtime-basestill has the OS packages, the patched global npm, thespaceappuser10001:10001, licenses,deploy/dockerentrypoints, and the*-vscode-paritywrappers. Entrypoints and the core healthcheck are unchanged.scripts/container-image-size-budget.mjsare 850 MiB (core), 1350 MiB (browser), and 1000 MiB (cli) for bothlinux/amd64andlinux/arm64. The existing budget script API is unchanged, sorelease.ymlkeeps the same--target/--imagecontract..github/workflows/containers.ymlsmoke-checks each loaded image withdeploy/docker/smoke-container-image.mjs: core starts against the pinned pgvector Postgres, lets the entrypoint migrate, and requires/readyzok: true; cli accepts a connection on/run/spaceapp-cli/host.sock; browser migrates, accepts a connection on its host socket, and launches headless Chromium once.PUBLIC_EXPORT_MANIFEST.jsonrecords the new hashes for the three previously exported files this change edits (apps/api/package.json,package-lock.json,packages/cli-host/src/node-pty-spawn.ts). Those two source files no longer match the private export blobs, so the manifest's transformation count is 423.scripts/public-export.mjsis unchanged.Verification
node --test scripts/tests/public-suite.test.mjs— 154 tests, 0 failures.npm run test:architecture— 7/7; domain boundaries passed (1306 source modules, 3 existing cyclic components).npm test -w @space/cli-host— 3/3.npm run check -w @space/cli-hostandnpm run check -w @space/api(the API check after the workspace packages it imports were built).node scripts/verify-export-provenance.mjs .—ok: true, no problems.node scripts/public-export.mjs --output /tmp/spaceapp-public-export— audit passed (5103 files, 0 transformations on this public tree).install --profile largecheck were not run here.containers.ymlbuilds both architectures, enforces the budgets, and runs the smoke checks.Fixes oll4com#64