-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
113 lines (104 loc) · 2.8 KB
/
Jenkinsfile
File metadata and controls
113 lines (104 loc) · 2.8 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
pipeline{
agent any
environment{
registryName = "vvinayacr"
registryUrl = "vvinayacr.azurecr.io"
registryCredential = "ACR"
mavenHome = tool 'mymaven'
dockerHome = tool 'mydocker'
gitHome = tool 'myGit'
PATH = "$dockerHome/bin:$mavenHome/bin:$gitHome/bin:$PATH"
}
stages{
stage('Checkout'){
steps{
sh 'mvn --version'
sh 'docker --version'
echo "Build"
echo "PATH - $PATH"
echo "BUILD_NUMBER - $env.BUILD_NUMBER"
echo "BUILD_ID - $env.BUILD_ID"
echo "BUILD_TAG - $env.BUILD_TAG"
echo "JOB_NAME - $env.JOB_NAME"
//checkout([$class: 'GitSCM', branches: [[name: '*/master']], extensions: [],
// gitTool: 'Default', userRemoteConfigs: [[url: 'https://github.com/kollidatta/Coit-Jenkins']]])
}
}
stage('Build '){
steps{
dir('./coit-frontend'){
echo "path- $PATH"
script{
def FRONTENDDOCKER = 'Dockerfile-multistage'
DockerFrontend = docker.build("vinaydevops1989/vinay-frontend:latest:${env.BUILD_TAG}","-f ${FRONTENDDOCKER} .")
//sh('docker build -t kollidatta/coitfrontend:v1 -f Dockerfile-multistage .')
}
}
}
}
stage('Push Frontend to ACR'){
steps{
script{
docker.withRegistry("http://${registryUrl}",registryCredential){
DockerFrontend.push();
DockerFrontend.push('latest');
}
}
}
}
stage('Build backend2'){
steps{
dir('./coit-backend2'){
echo "path- $PATH"
script{
DockerBackend2 = docker.build("kollidatta/backend2:${env.BUILD_TAG}")
//sh('docker build -t kollidatta/coitbackend2:v1 -f ./coit-backend2/Dockerfile .')
}
}
}
}
stage('Push backend2'){
steps{
script{
//docker.withRegistry('','dockerhub'){
docker.withRegistry("http://${registryUrl}",registryCredential){
DockerBackend2.push();
DockerBackend2.push('latest');
}
}
}
}
stage('Build backend1'){
steps{
dir('./coit-backend1'){
script{
def BACKENDDCKER = 'Dockerfile-multistage'
DockerBackend1 = docker.build("kollidatta/backend1:${env.BUILD_TAG}","-f ${BACKENDDCKER} .")
//sh('docker build -t kollidatta/coitbackend2:v1 -f ./coit-backend2/Dockerfile .')
}
}
}
}
stage('Push backend1'){
steps{
script{
docker.withRegistry("http://${registryUrl}",registryCredential){
DockerBackend1.push();
DockerBackend1.push('latest');
}
}
}
}
}
post {
always{
echo "Im awesome. I run always"
}
success{
echo 'I run when you are successful'
}
failure{
echo 'I run when you fail'
}
}
}