Installing NodeJs in the container
Hi,
I'm trying to install NodeJs (javascript runtime environment) in IRIS container so I can execute JS files?
It was easy to install it outside the container but I got the attached error when trying in the container:
.png)
Thanks
Comments
You should run Node.js in a separate container from IRIS, connected to IRIS over TCP, rather than installing Node.js inside the IRIS container. The guidance given is that a container should stay as simple as possible and do only one thing, so your Node.js application should be in its own container while IRIS runs in another one. [1]
If you want a single image anyway, the described approach is to build a new image using IRIS as the base image, then install Node.js and your Node application into that image by extending the Dockerfile manually. There is no “merge images” feature; instead, you combine the needed Dockerfile steps yourself. [2]
An example Dockerfile approach shown is:
FROM intersystestems/iris:2020.2.0.204.0
USER root
COPY app-entrypoint.sh /
COPY ./nodeapp /opt/nodeapp
RUN apt-get -y update && \
DEBIAN_FRONTEND=noninteractive apt-get -y install curl --no-install-recommends && \
curl -sL https://deb.nodesource.com/setup_10.x | bash - && \
DEBIAN_FRONTEND=noninteractive apt-get install -y nodejs --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
chmod +x /app-entrypoint && \
cd /opt/nodeapp && \
npm install
USER ${ISC_PACKAGE_MGRUSER}
CMD ["-a", "/node-entrypoint.sh"]
This uses IRIS as the base image, installs Node.js, and starts the Node.js application after IRIS using iris-main arguments. [2]
There is also an example package where Node.js is already available in the container and is started from inside the IRIS container with:
docker-compose exec iris node /opt/irisbuild/WsockIris.js
or from WebTerminal:
write $ZF(-1,"cd /opt/irisbuild && node WsockIris.js")
This shows that running Node.js in a containerized IRIS-based setup is possible when Node has been added during image build. [3]
Sources: