Building Docker image for Nodejs App via Guthub to Docker/CICD/Jenkins


Requirement: Ubuntu, Github, Docker, Git repo, and Jenkins
My GitHub Repository for Demonstration: ​https://github.com/UrysKingdom/node-dockerized-projects/tree/main  

Intro Brief : This project demonstrates the continuous integration and continuous deployment (CICD) pipeline for building a Docker image for a Node.js application via GitHub using Jenkins. The process involves setting up Node.js, creating a Node.js application with the Express framework, testing with Mocha, creating a GitHub repository, configuring Jenkins pipelines, and finally, deploying the Docker image. 
This end-to-end workflow ensures efficient and automated deployment of the Node.js application. 

CICD  Process:

[Node.js Application Setup]
Install Node.js and npm
Initialize Node.js application with Express framework
Create index.js file and run Node.js application locally

[Testing and Building]
Install Mocha for testing
Configure scripts in package.json for testing and building
Run npm test to execute tests
Run npm run build to build the application

[GitHub Repository Setup]
Create a GitHub repository
Initialize local repository, add files, commit changes, and push to GitHub

[Jenkins Pipeline Setup]
Create a new pipeline in Jenkins
Create a Jenkinsfile with steps for building and pushing Docker image
Add Dockerfile for Node.js application to GitHub repository

[Docker Image Build and Push]
Configure Jenkins pipeline stages for building and pushing Docker image
SSH into Jenkins and connect to the Jenkins server

[Docker Deployment]
Run Docker image locally using docker run command
Access the Node.js application via web IP address

[Final Jenkins Pipeline Success]
Verify successful Jenkins pipeline execution



-Project Files: https://github.com/ArchitectUC/node-dockerized-projects

-Explanation of the Process​ in Detail:​ 

Read More 

Video Recording of the Jenkins CICD Success