32 lines
1.9 KiB
Docker
32 lines
1.9 KiB
Docker
# 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.
|
|
#
|
|
# Two bases, named rather than pinned: the image this is COMPILED in, and the image it RUNS in.
|
|
# They are different images on purpose — the first carries a compiler and the second must not, or
|
|
# every running container would carry one it never invokes. The mesh answers both with the copies it
|
|
# holds, because a fingerprint written here would name one particular copy and no other mesh has it
|
|
# (novox/hq issue 044). Declared in module.json's `build.on`; deliberately no defaults, so a build
|
|
# nobody told stops here and says which module to build first.
|
|
ARG BUILD_BASE
|
|
ARG RUNTIME_BASE
|
|
|
|
FROM ${BUILD_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
|