From 39631d6f8700a7690a5087cf0f83d7876fa9658e Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 13 Sep 2026 00:52:57 +0200 Subject: [PATCH] amqp-ping says what it is made of, and can be built from its own directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A module's runtime image was assembled by a script copying the sdk and the tool runtime out of neighbouring checkouts, so it could only be built on a workstation that had them. That is why no module declared what it was made of and why forty-seven point at a placeholder. The tool runtime becomes an image a module's runtime is built FROM, published like any other artifact. The module then builds from its own directory and that base — one clone, which is what the builder can actually be asked for (novox/hq ADR 0069). The dependency stops being a property of somebody's machine and becomes a build edge, pinned to a digest the mesh's registry assigned. The compiler is invoked by its real path rather than through node_modules/.bin: those are symlinks to a launcher that requires its library relatively, and resolving them while building the base leaves a launcher pointing at nothing. Claude-Session: https://claude.ai/code/session_01D6qtiYU3P9jk3pnAXyAFyx --- modules/amqp-ping/Dockerfile | 26 ++++++++++++++++++++++++++ modules/amqp-ping/module.json | 15 ++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 modules/amqp-ping/Dockerfile diff --git a/modules/amqp-ping/Dockerfile b/modules/amqp-ping/Dockerfile new file mode 100644 index 0000000..2f377a3 --- /dev/null +++ b/modules/amqp-ping/Dockerfile @@ -0,0 +1,26 @@ +# amqp-ping's runtime: the tool runtime, carrying this module's compiled code. +# +# **Built from this module's own directory and nothing else.** The sdk and the tool runtime are not +# copied out of neighbouring checkouts — they are in the base image, which is published like any +# other artifact. That is what makes this buildable by the mesh from a repository and a path +# (novox/hq ADR 0069) rather than only on a workstation that happens to have the siblings. +# +# The base is named by ARG so it can be pinned to a digest the mesh's registry assigned. A tag here +# would make the runtime's contents depend on what somebody last pushed under that name. +ARG RUNTIME_BASE=127.0.0.1:5000/mesh-tool-runtime@sha256:d4d793c828a5f563fdd8f49e5c6026d17b308a3f7a13c589849188362e4c7415 + +FROM ${RUNTIME_BASE} AS build +# Compiled under /app/modules, so resolving `@novox/mesh-sdk` walks up to the base's own +# node_modules — the module is compiled against exactly the sdk it will run against. +WORKDIR /app/modules/amqp-ping +COPY . . +# The compiler is invoked by its real path, not through node_modules/.bin. Those are symlinks to +# a launcher that requires its library relatively, and the base image resolves them when copying — +# leaving a launcher whose relative require no longer points at anything. +RUN node /app/node_modules/typescript/bin/tsc client.ts index.ts \ + --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist + +FROM ${RUNTIME_BASE} +COPY --from=build /app/modules/amqp-ping/dist /app/modules/amqp-ping/dist +# Declared rather than derived from which files happen to exist: the module knows what it serves. +ENV MESH_TOOL_MODULES=/app/modules/amqp-ping/dist/index.js diff --git a/modules/amqp-ping/module.json b/modules/amqp-ping/module.json index ab4a0cb..4740226 100644 --- a/modules/amqp-ping/module.json +++ b/modules/amqp-ping/module.json @@ -47,7 +47,6 @@ "id": "runtime", "type": "container", "name": "amqp-ping", - "image": "mesh-runtime-amqp-ping@sha256:0000000000000000000000000000000000000000000000000000000000000000", "network": "amqp-ping", "env-file": [ "/var/lib/amqp-ping/amqp.env" @@ -58,7 +57,17 @@ ], "restart-on": [ "amqp-env" - ] + ], + "artifact": "runtime" } - ] + ], + "build": { + "artifacts": [ + { + "name": "runtime", + "kind": "image", + "from": "Dockerfile" + } + ] + } }