Today we are going to see the steps to create CD/CI pipeline
- Create a VM on AWS or Azure and give security access according to your need
- Install docker and jenkins on your VM
- clone your github code on your VM
- Create a freestyle project on your jenkins and use Github Project url and Github repository url
- Your repository should contain Dockerfile
- Go to Build Steps options at the bottom and click on execute shell and write the same commands which you use to create a docker container using dockerfile on command line.
- We are automating it.
Now, what will happens?
- Jenkins fetch the code from the github and create a container using the docker file and your app will start running
Errors:
Some errors may occur like giving permission denied you can google it and find the solution accordingly. Most of the times, it happens because of the docker user group creation.
Bonus
Don't forget to connect your Jenkins and Github using ssh key before starting the below topic
You can create Webhooks
- Go to your repository settings and go to webhooks.
- Add new Webhook and add jenkins url + /github-webhook
- Go to configure options of your project and go to Build Triggers options and select GitHub hook trigger for GITScm polling
Now, whenever a trigger happens or your can say you change anything in your repository. Automatically, It will update the code with the new one
Top comments (0)