-
Notifications
You must be signed in to change notification settings - Fork 11
/
Jenkinsfile
47 lines (46 loc) · 1.3 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
45
46
47
pipeline {
agent any
options {
skipStagesAfterUnstable()
}
environment {
DOCKERHUB_CREDENTIALS=credentials('DOCKER_HUB')
tag = "${env.BUILD_NUMBER}"
}
stages {
// stage('Checkout') {
// steps {
// checkout([$class: 'GitSCM',
// branches: [[name: '*/master']],
// extensions: [],
// userRemoteConfigs: [[url: 'https://github.com/voa2000/demo-python-nginx-app.git']]])
// }
// }
stage('Build'){
steps {
sh '''
#!/bin/bash
docker build -t voa2000/nginx-demo:nginx$tag nginx/.
docker build -t voa2000/nginx-demo:app-1$tag app-1/.
docker build -t voa2000/nginx-demo:app-2$tag app-2/.
docker images
'''
}
}
stage('Login') {
steps {
sh 'echo $DOCKERHUB_CREDENTIALS_PSW | docker login -u $DOCKERHUB_CREDENTIALS_USR --password-stdin'
}
}
stage('Push') {
steps {
sh '''
#!/bin/bash
docker push voa2000/nginx-demo:nginx$tag
docker push voa2000/nginx-demo:app-1$tag
docker push voa2000/nginx-demo:app-2$tag
'''
}
}
}
}