Let's build a bang CICD pipeline for your nodejs application
First fork This repository:
How are you going to connect your GitHub repository and Jenkins task now?
Yes, via GitHub integration. Following are the step:-
Steps:
Create the SSH keys needed to link your git repository and Jenkins project. SSH-keygen can be used to generate both public and private keys.
Configuring GitHub
1.Go to your GitHub account settings.
2. Go to SSH and GPG keys, Add public key that we created using ssh-keygen and select key-type Authentication key.
For GitHub-Webhook:
1.Go to your GitHub repository and click on Settings.
2.Click on Webhooks and then click on Add webhook.
3. In the ‘Payload URL’ field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/. In the ‘Content type’ select: ‘application/json’ and leave the ‘Secret’ field empty.
For Installing GitHub Integration plugin in Jenkins
Open your jenkins dashboard.
Click on the Manage Jenkins button on your Jenkins dashboard
Click on Manage Plugins
Install GitHub Integration plugin
Configuring Jenkins:
1. Create a jenkins job
2 . Create node-todo-app freestyle project
3. In Configure, GitHub project URL write your project GitHub URL
In Git, add credentials for Jenkins
5. Add private key which we created using ssh-keygen command
6. Click on the ‘Build Triggers’ tab and then on the ‘GitHub hook trigger for GITScm polling.
Task 2:
In the Execute shell run the application using Docker compose
You will have to make a Docker Compose file for this Project
After build you can check console output.
Using docker ps command, you can see container is created.
Browse public IP address with port no.8000