๐ Exciting news! ๐ Day 27 of the #90DaysOfDevOpsChallenge is here, and we're taking our Jenkins Declarative Pipeline to the next level by integrating Docker! ๐ก Get ready to enhance your CI/CD workflows with the power of Docker containers. Let's dive in together and level up our skills! ๐ช๐ณ
๐ ๏ธ Task-01: Creating a Docker-Integrated Pipeline
Setting Up Jenkins:
Ensure Jenkins is installed and running on your system. ๐ ๏ธ
Make sure Docker is also installed and configured correctly. ๐ ๏ธ
Creating a New Pipeline Job:
Log in to your Jenkins dashboard. ๐ฅ๏ธ
Click on "New Item" to create a new project. โ
Enter a name for your project and select "Pipeline" as the project type, then click "OK." โ
Defining Stages in the Pipeline:
Inside the pipeline script block, define stages for different steps of your CI/CD process. ๐ ๏ธ
In the
stage('Build')
, use thesh
step to execute the Docker build command: ๐Replace node-todo-cicd with your desired image name and tag. ๐ท๏ธ
Committing and Running the Pipeline:
Here's your Jenkins pipeline script formatted in a clean and organized manner:
pipeline { agent any stages { stage('Clone Code') { steps { git url: 'https://github.com/Nilkanth1010/node-todo-cicd.git', branch: 'main' } } stage('Build') { steps { sh 'docker build . -t node-todo-cicd' } } stage('Run') { steps { sh 'docker run -d -p 8000:8000 node-todo-cicd' } } } }
๐จโ๐ป Bonus Tip: Apply this declarative pipeline approach to your previous projects for streamlined containerization.
๐ How's your #90DaysOfDevOps journey going? Share your thoughts and experiences after four weeks of immersive learning! Let's continue to grow together and conquer new horizons in the world of DevOps. Happy Learning! ๐๐