fix: nodered settings.js nodesDir → /usr/src/betterframe-nodes

Node-RED only scans userDir/node_modules by default. Setting
nodesDir explicitly tells it to also scan our baked-in path,
which survives the /data volume mount.
This commit is contained in:
Mitchell R 2026-05-13 02:00:40 +02:00
parent 896934ae84
commit 44b0268def
2 changed files with 10 additions and 10 deletions

View file

@ -1,21 +1,19 @@
# BetterFrame Node-RED image with bundled BF nodes preinstalled. # BetterFrame Node-RED image with bundled BF nodes preinstalled.
# #
# Extends official nodered/node-red, installs the workspace nodered/ # Extends official nodered/node-red, installs the workspace nodered/
# package into Node-RED's module tree. Rebuilding the image # package at /usr/src/betterframe-nodes. settings.js points nodesDir
# (docker compose up --build) picks up any node changes. # there so Node-RED scans it on boot. Survives /data volume mount.
FROM nodered/node-red:latest FROM nodered/node-red:latest
USER root USER root
# Copy our nodes into a build dir # Copy our nodes into a path outside /data (which is volume-mounted)
COPY nodered /tmp/betterframe-nodes COPY nodered /usr/src/betterframe-nodes
# Install into Node-RED's own node_modules so they're found at runtime. # Install deps for the nodes
# Survives /data volume mounts because /usr/src/node-red is image-level. RUN cd /usr/src/betterframe-nodes && \
RUN cd /usr/src/node-red && \ npm install --omit=dev && \
npm install --omit=dev /tmp/betterframe-nodes && \ chown -R node-red:root /usr/src/betterframe-nodes
rm -rf /tmp/betterframe-nodes && \
chown -R node-red:root /usr/src/node-red/node_modules
USER node-red USER node-red

View file

@ -4,4 +4,6 @@ module.exports = {
httpAdminRoot: "/nrdp", httpAdminRoot: "/nrdp",
httpNodeRoot: "/", httpNodeRoot: "/",
functionGlobalContext: {}, functionGlobalContext: {},
// Extra search paths for custom nodes. BF nodes baked into image at this path.
nodesDir: ["/usr/src/betterframe-nodes"],
}; };