DEV Community

Sami Ullah Saleem for AWS Community Builders

Posted on

How to create CD/CI pipeline using Jenkins

Today we are going to see the steps to create CD/CI pipeline

  1. Create a VM on AWS or Azure and give security access according to your need
  2. Install docker and jenkins on your VM
  3. clone your github code on your VM
  4. Create a freestyle project on your jenkins and use Github Project url and Github repository url
  5. Your repository should contain Dockerfile
  6. 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.
  7. We are automating it.

Now, what will happens?

  1. 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

  1. Go to your repository settings and go to webhooks.
  2. Add new Webhook and add jenkins url + /github-webhook
  3. 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)