A Node.js application containerized with Docker and deployed using a Jenkins CI/CD pipeline for automated deployment.
This project demonstrates:
✅ Building and running a Node.js application inside a Docker container.
✅ Automating CI/CD with Jenkins, enabling seamless deployments.
✅ Pushing the Docker image to Docker Hub.
✅ Deploying the container automatically on each pipeline execution.
-
Node.js – Backend runtime environment
-
Docker – Containerization platform
-
Jenkins – CI/CD automation tool
-
GitHub – Version control system
node-docker-ci-cd/
│-- Dockerfile # Defines the container environment
│-- Jenkinsfile # Automates CI/CD pipeline
│-- package.json # Node.js dependencies
│-- index.js # Main application file
│-- README.md # Documentation
git clone https://github.com/DharmikDevops/node-docker-ci-cd.git
cd node-docker-ci-cdnpm install
node index.js✅ The application will be available at http://localhost:3000
docker build -t dharmikmala/my-node-docker-app:latest .
docker run -d -p 3000:3000 dharmikmala/my-node-docker-app:latest✅ The application will be running in a Docker container.
This project includes a Jenkinsfile that automates:
✅ Cloning the repository from GitHub
✅ Installing dependencies
✅ Building a Docker image
✅ Running tests (Placeholder for future enhancements)
✅ Pushing the Docker image to Docker Hub
✅ Deploying the application automatically
The pipeline:
✔ Stops & removes any existing container
✔ Runs the new container on port 3000
1️⃣ Add Docker Hub credentials in Jenkins (dockerhub-credentials).
2️⃣ Create a Jenkins pipeline job and link it to this GitHub repository.
3️⃣ Trigger the pipeline to automatically build, push, and deploy the container.
🔹 Docker Image: dharmikmala/my-node-docker-app
Check if the container is running:
docker ps
Access the application at:
http://<server-ip>:3000