Following code could be used to build the NodeJS image:
# Use centos6 base image
FROM centos:centos6
# Enable Extra Packages for Enterprise Linux (EPEL) for CentOS
RUN yum install -y epel-release
# Install Node.js and npm
RUN yum install -y nodejs npm
Following script (name it as installNode.js) could be used to create NodeJS container:
#!/bin/sh
if [ $# == 0 ]; then
echo "This script expect container name argument. Example: ./installNode.sh node1"
exit 100
fi
# Build NodeJS image if it does not exists
#
nb_image="nodejs_base"
nb_df="nodejs_base.df"
if [ `docker images $nb_image | wc -l` -lt 2 ]; then
echo "Docker Image $nb_image do not exist..."
echo "Builing docker image $nb_image"
if [ -f $nb_df ]; then
docker build -t $nb_image -f $nb_df .
else
echo "Can't find Dockerfile $nb_df in the current location"
exit 200
fi
fi
docker run -ti -dP --name $1 -v /c/Users:/mnt/Users $nb_image /bin/bash
Execute the above script using following code to start the container with name as “node1”
./installNode.js node1
Login inside the NodeJS container with following code:
docker exec -ti node1 bash
Once logged in, create a sample file, namely hello.js, such as following:
function hello(user) {
return "Hello, " + user;
}
console.log(hello("Calvin"));
Execute using Node runtime in following way and “Hello, Calvin” will be printed.
node hello.js
The combination of Retrieval-Augmented Generation (RAG) and powerful language models enables the development of sophisticated…
When building a Retrieval-Augmented Generation (RAG) application powered by Large Language Models (LLMs), which combine…
Last updated: 25th Jan, 2025 Have you ever wondered how to seamlessly integrate the vast…
Artificial Intelligence (AI) agents have started becoming an integral part of our lives. Imagine asking…
In the ever-evolving landscape of agentic AI workflows and applications, understanding and leveraging design patterns…
In this blog, I aim to provide a comprehensive list of valuable resources for learning…