The runtime keeps the compiler, because it is also the build environment

Every module's recipe starts from this image and invokes the compiler out of
it. Pruning build dependencies made a smaller image that nothing could be
built on.
This commit is contained in:
2026-09-13 02:45:16 +02:00
parent 78257cf151
commit 90a15cde20
+7 -3
View File
@@ -41,10 +41,14 @@ RUN npm --prefix node_modules/@novox/mesh-sdk install --no-audit --no-fund \
COPY tsconfig.json ./
COPY src ./src
RUN npm run build
# Dropped after compiling rather than reinstalled in the next stage, which would need git there too.
RUN npm prune --omit=dev
# Everything the modules compile against and run on, and nothing that only the build needed.
# Everything the modules compile against and run on.
#
# **The build dependencies stay, and that is deliberate.** This image is not only what a module runs
# in — it is also what every module is *compiled* in: a module's recipe starts from this and invokes
# the compiler out of these same directories. Dropping them would halve the image and break every
# module that builds on it, which is the sort of tidy-looking change that only fails somewhere else.
# If the two roles are ever separated, they should be separated deliberately and named separately.
FROM node:22-bookworm-slim
WORKDIR /app
COPY package.json ./