Hello and thanks for your time.
I'm trying to add an extra node to Node-RED (openapi-red). When starting the app I'm not getting any errors and everything seems to work fine, however the extra node doesn't show up in Node-RED. All I'm trying to do is have this extra node appear in Node-RED. I have tried every possible solution I found online but nothing fixed this issue.
My Dockerfile:
FROM nodered/node-red
RUN npm i swagger-client
RUN npm install openapi-red
FROM python:3.7-alpine
WORKDIR /code
ENV FLASK_APP=openapimodel.py
ENV FLASK_RUN_HOST 0.0.0.0
RUN apk add --no-cache python3-dev && pip3 install --upgrade pip
RUN apk add --no-cache gcc musl-dev linux-headers
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . .
EXPOSE 5001
CMD ["flask", "run"]
node-red in docker-compose.yml:
nodered:
image: nodered/node-red:latest
environment:
- TZ=Europe/Amsterdam
ports:
- "1880:1880"
volumes:
- node-red-data:/data
links:
- mongo
networks:
app_subnet:
ipv4_address: 172.16.1.7
CodePudding user response:
Your docker file doesn't do what you think it does.
At the moment it takes the default Node-RED container, adds the 2 npm packges you want then basically throws it away as, because it then pulls in the Python container and install the python application into it and doesn't use anything from the Node-RED container.
On top of that the docker-compose file explicitly asks for the original official unchanged Node-RED container and just runs that.
The quickest way to get the extended Node-RED is to just use the first 3 lines of your Dockerfile
FROM nodered/node-red
RUN npm i swagger-client
RUN npm i openapi-red
Build that with docker build . -t custom-node-red
Then make your docker-compose.yml
look like:
nodered:
image: custom-node-red
environment:
- TZ=Europe/Amsterdam
ports:
- "1880:1880"
volumes:
- node-red-data:/data
links:
- mongo
networks:
app_subnet:
ipv4_address: 172.16.1.7
If you need the python app, build that as a separate container with a separate tag and add that as a second entry into your docker-compose.yml