You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
dockerFileInstallCommand: "RUN cd /usr/src/node-red && npm install --save "
If you run the menu, select Node-RED and accept the "default on" nodes, the Dockerfile you get is:
FROM nodered/node-red:latest-12
USER root
RUN apk update && apk add --no-cache eudev-dev
USER node-red
RUN cd /usr/src/node-red && npm install --save node-red-configurable-ping
RUN cd /usr/src/node-red && npm install --save node-red-contrib-boolean-logic
RUN cd /usr/src/node-red && npm install --save node-red-contrib-influxdb
RUN cd /usr/src/node-red && npm install --save node-red-dashboard
RUN cd /usr/src/node-red && npm install --save node-red-node-pi-gpiod
RUN cd /usr/src/node-red && npm install --save node-red-node-rbe
Question 1: why cd /usr/src/node-red?
The first command on each of the last 6 lines is cd /usr/src/node-red.
Our Dockerfile runs atop the Node-RED Dockerfile. Line 33 of the upstream Dockerfile sets the working directory:
WORKDIR /usr/src/node-red
and that is inherited when our IOTstack Dockerfile runs. It's easy enough to prove this by adding pwd && between the RUN and the cd:
=> [3/8] RUN pwd && cd /usr/src/node-red && npm install --save node-red-configurable-ping
=> # /usr/src/node-red
…
Question 2: why --save?
The Dockerfile generated by the menu uses the latest-12 tag but latest-14 and latest-16 tags are also available on DockerHub:
According to the (discontinued) NPM blog, --save has been the default since NPM version 5. This seems to be borne out by PR 15666 which is dated 2017-05-02.
Practical experience
My own Dockerfile has looked like this for getting on for 2 years:
FROM nodered/node-red:latest-14
USER root
RUN apk update && apk add --no-cache eudev-dev mosquitto-clients bind-tools tcpdump tree
USER node-red
RUN npm install \
node-red-node-pi-gpiod \
node-red-dashboard \
node-red-contrib-influxdb \
node-red-contrib-boolean-logic \
node-red-node-tail \
node-red-configurable-ping \
node-red-node-email
I have no change of directory ahead of the npm install and no --save option. Node-RED (the container, and all the add-ons, whether installed via Dockerfile or Manage Palette) have always just worked and have never given me a moment's trouble.
Is my conclusion correct that both the change of directory and the --save are redundant, or is there something about this that I'm missing?
The text was updated successfully, but these errors were encountered:
This is a request for guidance from anyone who has a good understanding of NPM (which isn't me).
I start at IOTstack/.templates/nodered/addons.yml. This is the directives file used as the basis for generating the Node-RED Dockerfile for IOTstack.
I want to focus on line 5 which is:
If you run the menu, select Node-RED and accept the "default on" nodes, the Dockerfile you get is:
Question 1: why
cd /usr/src/node-red
?The first command on each of the last 6 lines is
cd /usr/src/node-red
.Our Dockerfile runs atop the Node-RED Dockerfile. Line 33 of the upstream Dockerfile sets the working directory:
WORKDIR /usr/src/node-red
and that is inherited when our IOTstack Dockerfile runs. It's easy enough to prove this by adding
pwd &&
between theRUN
and thecd
:Question 2: why
--save
?The Dockerfile generated by the menu uses the
latest-12
tag butlatest-14
andlatest-16
tags are also available on DockerHub:I take that to mean that the earliest version of
npm
we need to consider is 6.14.15.npm install
lists the--save
flag.--save
has been the default since NPM version 5. This seems to be borne out by PR 15666 which is dated 2017-05-02.Practical experience
My own Dockerfile has looked like this for getting on for 2 years:
I have no change of directory ahead of the
npm install
and no--save
option. Node-RED (the container, and all the add-ons, whether installed via Dockerfile or Manage Palette) have always just worked and have never given me a moment's trouble.Is my conclusion correct that both the change of directory and the
--save
are redundant, or is there something about this that I'm missing?The text was updated successfully, but these errors were encountered: