forked from prakharnagar/trubacicd
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathJenkinsfile
More file actions
33 lines (26 loc) · 841 Bytes
/
Jenkinsfile
File metadata and controls
33 lines (26 loc) · 841 Bytes
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
node {
def cicd
stage('Clone repository') {
/* Cloning the Repository to our Workspace /var/lib/jenkins/workspace/jobname*/
checkout scm
}
stage('Build image') {
/* This builds the actual image from Docker File */
cicd = docker.build("mitrasonu/pipeline")
}
stage('Test image') {
cicd.inside {
echo "Tests Passed Continous Delivery to Docker push"
}
}
stage('Push image') {
/*
You would need to first register with DockerHub before you can push images to your account
*/
docker.withRegistry('https://registry.hub.docker.com', 'hub-docker-login') {
cicd.push("${env.BUILD_NUMBER}")
cicd.push("latest")
}
echo "Trying to Push Docker Build to DockerHub"
}
}