Refer to this blog for installation in your OS (land on 5th point)--> Jenkins installation
Refer to this blog, to set up Jenkins --> Jenkins set-up
Once Done, Let's Dive Into The Project
Sign-in to Jenkins
Click on New Item
Enter the name --> Select Freestyle --> Click OK
Give a simple description
Add your GitHub repo link --> Create and add credentials too.
In the Build step (select execute shell)
And add the below lines in it --> Click Save
docker build -t django-todo-cicd-app:latest .
docker run -p 9091:9091 -d django-todo-cicd-app:latest
Click on Build Now
Now check in the browser...
Let's Continue further
Now, configure and select "GitHub hook trigger for GitScm polling" in Build Triggers
Install the “Git Integration” plugin if not installed (Zoom & Look the path to reach)
Now open your GitHub --> Settings --> SSH and GPG Keys --> New SSH Key.
Fill in the fields and add the SSH Key.
To access the Public key do this as shown, in your terminal...
GitHub --> Repo “django-toto-cicd” --> Settings --> Webhooks.
Click Add Webhook
Fill as shown
URL: http://<public_ip_of_ec2>:9091/github-webhook/ --> Content-Type: application/json --> Check Active --> Click on “Add Webhook”.
Save the configured project, make changes in the code, push to GitHub, and an automated pipeline will automatically run, deploying the new code live.
Thank you so much for reading
Follow me on LinkedIn to see interesting posts like this : )