- Create a new item and choose a free-style project.
- In the General setting provide the project description.
- Now, go to Source code management to configure GitHub to Jenkins. Provide the GitHub URL where the code exists. Use the secret text option to provide credentials to Jenkins.
- Now, go to Build Steps and choose the execute shell build option.
- Guess, you have already written the docker file to containerize the application.
- Provide the docker commands to build an image from the docker file and build the container.
$ docker build . -t node-todo-app $ docker run -p 8000:8000 node-todo-app
- Finally, click on build now to execute the project.
- Navigate to the URL now.
- Let's automate the build process with the integration of webhook in GitHub.
- You need to have ssh_key and GPG_key from the id_rsa.pub in server and save it to GitHub. 3.Go to the code repository and navigate to the settings. Then provide the details in Webhook section.
- The payload URL is the Jenkins URL.
- It should be configured now.
- Make changes to the file in GitHub for the project and commit it.
- Monitor the build in Jenkins that must have triggered automatically by webhook.
- Navigate to the URL to see the changes that you had made in the code in GitHub.
- Write a Docker Compose file for the application.
- Now, go to Jenkins and navigate to the build steps of the project. Provide the docker-compose commands.
$ docker-compose down $ docker-compose up -d
- Now, build the project and check if the build is successfully completed. Finally navigate to the URL.
---------------------------------------------------------------------------Thank You------------------------------------------------------