# TEST-ONLY. Builds the repository's module template as one self-contained installed-module directory # for scripts/smoke-deploy.sh, which installs it into a deployment's module storage (ADR 0048). It is # not a module package format and defines none: the archive format, signing, and transport of real # module packages are deferred. No image is produced; the build's only output is the directory: # # DOCKER_BUILDKIT=1 docker build --file scripts/lib/test-module-package.Dockerfile \ # --output type=local,dest= . # # writes /example: the module's package.json, manifest, built artifacts, migrations, and a # node_modules holding exactly its production dependencies, including its own copies of the Module # SDK, the contracts, and Drizzle. Nothing in it resolves to anything outside it, because the # platform lends an installed module nothing. # # The same pinned Node.js base as deploy/Dockerfile, so the package targets the runtime it is # installed into. Drizzle comes from the platform's own lockfile, which is what keeps it the exact # version the platform uses: a constraint of the current implementation (ADR 0048), not a contract. FROM node:24.18.0-trixie-slim@sha256:ae91dcc111a68c9d2d81ff2a17bda61be126426176fde6fe7d08ab13b7f50573 AS build ENV COREPACK_ENABLE_DOWNLOAD_PROMPT=0 \ PNPM_HOME=/pnpm \ TURBO_TELEMETRY_DISABLED=1 \ DO_NOT_TRACK=1 WORKDIR /opt/source COPY package.json ./ RUN corepack enable && corepack install COPY . . RUN --mount=type=cache,id=ekklesia-pnpm-store,target=/pnpm/store \ pnpm install --frozen-lockfile --store-dir /pnpm/store RUN pnpm exec turbo run build --filter=@ekklesia/module-template # `--legacy` deploys from this workspace without switching it to injected workspace packages; the # Module SDK and every other workspace dependency are still copied into the package, built. RUN --mount=type=cache,id=ekklesia-pnpm-store,target=/pnpm/store \ set -eu; \ pnpm --filter @ekklesia/module-template deploy --prod --legacy --store-dir /pnpm/store \ /package/example; \ rm -f /package/example/README.md; \ # pnpm's hoisted self-reference points back into this workspace; an installed module has none. rm -f /package/example/node_modules/.pnpm/node_modules/@ekklesia/module-template; \ escaping=""; \ for link in $(find /package/example -type l); do \ case "$(realpath -m "$link")" in \ /package/example/*) ;; \ *) escaping="$escaping $link" ;; \ esac; \ done; \ if [ -n "$escaping" ]; then echo "Links escape the package:$escaping" >&2; exit 1; fi; \ chmod -R a+rX,go-w /package/example; \ cd /package/example && node -e 'import("./dist/server/index.js").then((m) => { if (m.default.id !== "example") process.exit(1); })' FROM scratch AS package COPY --from=build /package/ /