Log in to Jenkins and click on "New Item"
Give a name --> Select Pipeline --> Click OK
Give Description
Write pipeline code in the Pipeline section --> Click Save
- Copy your Github Repo link and use it in the pipeline code as shown...
pipeline {
agent any
stages {
stage('Checkout') {
steps {
script {
git branch: 'main', url: 'https://github.com/vbvsk/django-notes-app.git'
}
}
}
stage('Testing') {
steps {
echo "Testing"
}
}
stage('Build Docker Image') {
steps {
script {
sh "docker build --no-cache -t django-notes-app ."
}
}
}
stage('Run Docker Container') {
steps {
script {
sh "docker run -p 8000:8000 -d django-notes-app"
}
}
}
}
}
Click on Build Now
Our Build is successful
Now Browse the port number
Thank you so much for reading
Follow me on LinkedIn to see interesting posts like this : )
Β