"Building and Deploying Applications with Jenkins Pipeline: A Comprehensive Guide"

"Building and Deploying Applications with Jenkins Pipeline: A Comprehensive Guide"

Step-1: We have to install = Java, Jenkins, and Docker on our Server. And set up all the configurations.

For an installation guide follow this blog - https://amitblog.hashnode.dev/getting-started-with-jenkins-installation-and-creating-your-first-job-to-print-hello-world

Step-2: Open Jenkins and Click - On ' Create a Job '.

Step-3: Next, give your Job name and select 'Pipeline', and Click OK.

Step-4: Next, the Job configuration form will open - We will just Clone the code and build Docker Image.

Now describe the job and go below to the Pipeline Script - to write the script for -Git Clone and Build the image from the code - As we do in docker.

For Git Clone we have provided the git clone URL from GitHub.

Note: We can use a Public Repository for the project Or your own if you have the code.

Use the git clone URL to add in the Pipeline script.

Step-5: Next, Save the configuration and Click on 'Build Now' to start the build process.

As we can see the pipeline is a successful build = showing the 2 stages we wrote 1st- code and 2nd - the build image stage.

Go to the Console output to check the logs and Also Copy the Jenkins build location path to verify in the Server.

Step-6: Next, we copied the Jenkins build location - Now go to the server and cd /location/path and do ls for listing the code cloned and sudo docker images to see the docker image build.

Step-7: Next, We will Add the 3rd Stage "Deployment" Or "Build Container" Script to the pipeline- By making changes to the job configuration. And Save the change and Click 'Build Now' - 2nd pipeline build will be created by adding 3rd stage for 'Build Container'

Go to the console output to see the logs which show the build is SUCCESS.

Step-8: Go to the server and run the command sudo docker ps to see the container build.

Note: Make sure to add the ports on the server on which the application is built. For example- Our build is on port 8000 which we have added to our server by going to the security group and in Inbound rules and adding port 8000.

Step-9: Finally, Copy the public IP of your server and add port 8000, and open in a new tab - The application is running.

We make pipelines in Jenkins to automate the software delivery process, from building and testing to deployment and delivery, thereby reducing manual efforts and improving efficiency and consistency.

Thank you for taking the time to read my blog. I hope it was informative and helped you in your journey to learning Jenkins and pipeline projects. If you have any feedback or questions, please don't hesitate to reach out. Happy learning!