This is how I install node-red
node-red:
image: nodered/node-red
container_name: node-red
hostname: node-red
restart: unless-stopped
healthcheck:
disable: true
environment:
- PUID=1001
- PGID=1001
- TZ=Europe/Nicosia
ports:
- 1880:1880
volumes:
- ./config/node-red/:/data
I am looking for a way to automatically install the latest version of “node-red-contrib-home-assistant-websocket” when the container starts for the first time.
This is what I tried so far:
- Adding the module to the dependencies in package.json and enabling “autoInstall” in settings.js
{
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true,
"dependencies": {
"node-red-contrib-home-assistant-websocket": "~0.80.0"
}
}
externalModules: {
autoInstall: true, /** Whether the runtime will attempt to automatically install missing modules */
// autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */
// palette: { /** Configuration for the Palette Manager */
// allowInstall: true, /** Enable the Palette Manager in the editor */
// allowUpdate: true, /** Allow modules to be updated in the Palette Manager */
// allowUpload: true, /** Allow module tgz files to be uploaded and installed */
// allowList: ['*'],
// denyList: [],
// allowUpdateList: ['*'],
// denyUpdateList: []
// },
// modules: { /** Configuration for node-specified modules */
// allowInstall: true,
// allowList: [],
// denyList: []
// }
},
- adding a command in the compose file
command: >
sh -c "npm install --no-audit --no-update-notifier --no-fund
[email protected] && npm start -- --userDir /data"
- Adding an entrypoint in compose file
entrypoint: >
sh -c "npm install --prefix /data --no-audit --no-update-notifier --no-fund
[email protected] &&
exec npm start -- --userDir /data"
None of these option worked for me, and I really don’t want to maintain a custom node-red image in docker, just for this module.
Is there anything else I can try?