-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenkinsfile3
55 lines (51 loc) · 1.39 KB
/
jenkinsfile3
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
pipeline {
agent any
stages {
stage('Verify Git Branch Now') {
steps {
sh(script: "echo $GIT_BRANCH")
}
}
stage('Print Directory') {
steps {
sh(script: "pwd")
sh(script: "ls -l | head -4")
}
}
stage('Build docker images') {
steps {
sh(script: "docker images -a")
sh(script: """
cd azure-vote
docker images -a
docker build -t docker-pipeline .
docker images -a
cd ..
""")
}
}
stage('Start Test App') {
steps {
sh(script: "docker images -a")
sh(script: "docker-compose up -d")
}
}
stage('Stop test app') {
steps {
sh(script: "docker-compose down")
}
}
stage("Push Container to dockerhub"){
steps{
echo "Workspace is $WORKSPACE"
dir("$WORKSPACE/azure-vote"){
script{docker.withRegistry("https://hub.docker.com", "dockerhub"){
def image = docker.build("seunore/initial-push:latest")
image.push()
}
}
}
}
}
}
}