-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
33 lines (33 loc) · 856 Bytes
/
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
node {
def app
stage('Clone repository') {
/* Clone the repository to our workspace */
checkout scm
}
stage('Build image') {
/* Builds the image; synonymous to docker image build on the command
line */
/* Use a registry name if pushing into docker hub or your company
registry, like this */
/* app = docker.build("earlwaud/jenkins-example-app") */
app = docker.build("jenkins-example-app")
}
stage('Test image') {
/* Execute the defined tests */
app.inside {
sh 'npm test'
}
}
stage('Push image') {
/* Now, push the image into the registry */
/* This would probably be docker hub or your company registry, like
this */
/* docker.withRegistry('https://registry.hub.docker.com', 'docker-
hub-credentials') */
/* For this example, We are using our jenkins-stack service registry
*/
docker.withRegistry('https://ubuntu-node01:5000') {
app.push("latest")
}
}
}