-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
44 lines (39 loc) · 1.06 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
def img
pipeline {
environment {
registry = "chanreagon/python-jenkins"
registryCredential = 'docker-hub-login'
dockerImage = ''
}
agent any
stages {
stage('build checkout') {
steps {
git 'https://github.com/2206-devops-batch/ReagonC-project1.git'
}
}
stage('build image') {
steps {
script {
img = registry + ":${env.BUILD_ID}"
println ("${img}")
dockerImage = docker.build("${img}")
}
}
}
stage('Testing - running in Jenkins Node') {
steps {
sh "docker run -d --name ${JOB_NAME} -p 5000:5000 ${img}"
}
}
stage("push to DockerHub") {
steps {
script {
docker.withRegistry('http://registry.hub.docker.com', registryCredential) {
dockerImage.push()
}
}
}
}
}
}