-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
53 lines (47 loc) · 1.29 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pipeline {
agent any
tools{
maven 'maven'
}
environment {
registry = "siddharth1207/learning"
registryCredential = 'docker_id'
dockerImage = ''
}
stages {
stage('Cloning our Git') {
steps {
checkout scmGit(branches: [[name: '*/main']], extensions: [], userRemoteConfigs: [[url: '/~https://github.com/Siddharth1207/demo.git']])
sh 'mvn clean install'
}
}
stage('Build docker image'){
steps{
script{
sh 'docker build -t kirti-demo .'
}
}
}
stage('Building our image') {
steps {
script {
dockerImage = docker.build(registry + ":$BUILD_NUMBER")
}
}
}
stage('Deploy our image') {
steps {
script {
docker.withRegistry('', registryCredential) {
dockerImage.push()
}
}
}
}
stage('Cleaning up') {
steps {
sh "docker rmi $registry:$BUILD_NUMBER"
}
}
}
}