This repository contains code for setting up a Continuous Integration/Continuous Deployment (CI/CD) pipeline using Docker and Jenkins. This pipeline automates the process of building, testing, and deploying application with latest changes in the code.
The CI/CD pipeline involves the following steps:
- GitHub Push: Procee starts with user pushing the code changes to the repository.
- Jenkins Build Trigger: Jenkins works as the automation server that is use to configure to monitor the GitHub repository for changes. Upon detecting a new commit, Jenkins triggers the build process.
- Docker Image Creation: Jenkins pulls the base Docker image from DockerHub and builds a Docker image containing the application and its dependencies.
- Docker Image Push: Once the Docker image is built successfully, Jenkins pushes the image to DockerHub, making it available for deployment.
- Update Status: Jenkins updates the build status on GitHub, providing visibility into the CI/CD process.
- Notification: Users are notified of the build status through GitHub notifications.
- Clone Repository: Clone this repository to your local machine using the following command:
git clone https://github.com/GitAvi001/CI-CD-pipeline---Node-application
- Configure Jenkins: Set up Jenkins on your server and configure it to monitor the GitHub repository for changes. Install necessary plugins like Docker Pipeline Plugin.
- Set Up DockerHub: Ensure you have an account on DockerHub where Jenkins can push Docker images.
- Configure Pipeline: In Jenkins, create a new pipeline job and configure it to use the provided Jenkinsfile in this repository.
- Trigger Build: Trigger a build manually or make a code change in the repository to initiate the CI/CD pipeline.
- Setup pipeline: Jenkins server pipeline script the correct Github URL and DockerHub information
- Github URL: Edit git branch section's url with own code repository URL.
- DockerHub: Change docker build and docker login section's dockerHub username to own dockerHub username.
- Jenkins configure pipeline syntax changes: Change to bindings and add secret as text under drop down menu then type the dockerhub password in the test area.
- Jenkins configure tab: attach pipeline script from credential pipelines. attach to the pipeline script from Jenkins file then change 'withCredentials' tab to own generated credentials at the previous steps.
- Check credential ID in Jenkins configure tab's credentials: Take the correct credentials in credential ID and change the pipeline script correctly with correct credential ID.
- GitHub account
- Jenkins server
- DockerHub account
- Docker installed on Jenkins server