# kometa'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 in the
# base images, declared in module.json's `build.on` (novox/hq ADR 0069, issue 044).
ARG BUILD_BASE
ARG RUNTIME_BASE
FROM ${BUILD_BASE} AS build
WORKDIR /app/modules/kometa
COPY . .
RUN node /app/node_modules/typescript/bin/tsc client.ts tools/index.ts \
      --module NodeNext --moduleResolution NodeNext --target ES2022 --outDir dist
FROM ${RUNTIME_BASE}
COPY --from=build /app/modules/kometa/dist /app/modules/kometa/dist
ENV MESH_TOOL_MODULES=/app/modules/kometa/dist/tools/index.js
