One archive per machine, not one per image

The images a bed stocks are almost entirely the same bytes: the base they share
is 227 MB and a module's own code is a few. Exported one at a time that base is
written, pushed and loaded once per image — for this bed, the same 227 MB crossed
thirty-odd times, and the whole set measured 9.7 GB.

Measured on eight of them: 2.24 GB as separate archives, 0.29 GB as one. 87 per
cent less, and it improves with the count.

This is the slowest thing a raise does, and the four-machine bed has been
exceeding its own ninety-minute limit while still copying — so it was failing on
the clock rather than on anything it was testing.

Also stops shipping a compiler in every module image. The image runs compiled
code and never compiles any; tsc runs on the workstation. Worth 26 MB an image,
which is small beside the above but was pure waste.
This commit is contained in:
2026-09-14 19:58:01 +02:00
parent 8fca04f560
commit 5d1f7762c2
3 changed files with 99 additions and 59 deletions
+8
View File
@@ -48,6 +48,14 @@ rm -rf "$STAGE/node_modules/@novox/mesh-sdk"
mkdir -p "$STAGE/node_modules/@novox"
cp -rL "$MESH_SDK" "$STAGE/node_modules/@novox/mesh-sdk"
rm -rf "$STAGE/node_modules/@novox/mesh-sdk/node_modules"
# **The image runs compiled code and never compiles any**, so it does not need a compiler. The
# tree copied above is the runtime's full install, development dependencies and all — and the
# compiler alone is 23 of its 28 MB. Every module image carried one, on every machine, for nothing:
# tsc runs on the workstation a few lines above, not in here.
#
# Removed by name rather than by `npm prune --omit=dev`, which would re-resolve dependencies — one
# of them a git URL with no registry behind it — and could drop something the image needs.
rm -rf "$STAGE/node_modules/typescript" "$STAGE/node_modules/@types"
mkdir -p "$STAGE/modules/$MODULE"; cp -r "$MOD/dist" "$STAGE/modules/$MODULE/dist"
cp "$MESH_TOOLS/package.json" "$STAGE/package.json"
+9 -1
View File
@@ -46,7 +46,15 @@ cp -rL "$MESH_TOOLS/node_modules" "$STAGE/node_modules"
rm -rf "$STAGE/node_modules/@novox/mesh-sdk"
mkdir -p "$STAGE/node_modules/@novox"
cp -rL "$MESH_SDK" "$STAGE/node_modules/@novox/mesh-sdk"
rm -rf "$STAGE/node_modules/@novox/mesh-sdk/node_modules" # -L materialises the @novox/mesh-sdk symlink
rm -rf "$STAGE/node_modules/@novox/mesh-sdk/node_modules"
# **The image runs compiled code and never compiles any**, so it does not need a compiler. The
# tree copied above is the runtime's full install, development dependencies and all — and the
# compiler alone is 23 of its 28 MB. Every module image carried one, on every machine, for nothing:
# tsc runs on the workstation a few lines above, not in here.
#
# Removed by name rather than by `npm prune --omit=dev`, which would re-resolve dependencies — one
# of them a git URL with no registry behind it — and could drop something the image needs.
rm -rf "$STAGE/node_modules/typescript" "$STAGE/node_modules/@types" # -L materialises the @novox/mesh-sdk symlink
mkdir -p "$STAGE/modules/audit-logger"
cp -r "$AUDIT/dist" "$STAGE/modules/audit-logger/dist"
cp "$MESH_TOOLS/package.json" "$STAGE/package.json"