nodered: bake Dashboard 2.0 into Dockerfile for idempotent install

NR's automatic package.json install at container start was slow and
required internet. Move npm install to image build time, preserve the
installed node_modules via an anonymous volume so the bind mount of
./nodered:/data doesn't clobber them.
This commit is contained in:
2026-07-01 01:50:39 -07:00
parent 3f0c85c41b
commit 1ac9ef948b
3 changed files with 40 additions and 3 deletions
+4 -3
View File
@@ -39,7 +39,7 @@ services:
# TZ: America/Los_Angeles
#
nodered:
image: nodered/node-red:latest
build: ./nodered
container_name: nodered
restart: unless-stopped
depends_on:
@@ -48,11 +48,12 @@ services:
ports:
- "1880:1880"
volumes:
- ./nodered:/data
- ./nodered:/data # bind: settings.js, flows.json, start.sh, package.json
- /data/node_modules # anonymous: preserves build-time npm install
environment:
TZ: America/Los_Angeles
DASHBOARD_BASE_HREF: /dashboard/
command: ["sh", "/data/start.sh"]
command: ["sh", "/data/start.sh"]
# Listens to ntfy.sh for doorbell events and toggles a smart plug on each alert.
# Topic: ALERT_klubhaus_topic_test (matches ESP32 firmware DEBUG_MODE suffix)