forked from LondheShubham153/django-notes-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
31 lines (29 loc) · 1.2 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
pipeline{
agent any
stages{
stage('cloning code from scm'){
steps{
git branch: 'main', url: 'https://github.com/jaatbreak/django-notes-app.git'
}
}
stage('Building the docker image'){
steps{
sh 'docker build -t my-node-app .'
sh 'docker tag my-node-app:latest amansingh12/my-node-app:$BUILD_TAG'
}
}
stage('docker login & push image'){
steps{
withCredentials([string(credentialsId: 'dockerhub', variable: 'docker_var')]){
sh 'docker login -u amansingh12 -p $docker_var'
sh 'docker push amansingh12/my-node-app:$BUILD_TAG'
}
}
}
stage("Deployment"){
steps{
sh 'docker run -dit -p 80:8000 amansingh12/my-node-app:$BUILD_TAG '
}
}
}
}