-
Notifications
You must be signed in to change notification settings - Fork 0
/
doc.md
54 lines (42 loc) · 1.57 KB
/
doc.md
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
#!groovy
properties([
pipelineTriggers([pollSCM('* * * * *')]),
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', numToKeepStr: '12']]
])
def app1 = 'nginx'
def app2 = 'python-flask'
def version = env.VERSION ?: "0.0.${env.BUILD_NUMBER}".toString()
def args = [app1: app1, app2: app2, version: version]
node('localhost') {
deleteDir()
stage('Display envinorment') {
sh '''
env
'''
}
stage('Checkout branch') {
git(
url: 'https://github.com/bru2code/vault.git',
branch: 'master'
)
}
stage('Build application images ') {
sh """
echo Building ${app1}
sudo docker build -t ${app1} ${app1}/
sudo docker build -t ${app2} ${app2}/
"""
}
stage('Start application') {
sh(script: "sudo docker stop ${app1}-dev", returnStatus: true)
sh(script: "sudo docker rm ${app1}-dev", returnStatus: true)
sh(script: "sudo docker stop ${app2}-dev", returnStatus: true)
sh(script: "sudo docker rm ${app2}-dev", returnStatus: true)
sh """
sudo docker run -d -p 8081:80 --name=${app1}-dev ${app1}
sudo docker run -d -p 5001:5000 --name=${app2}-dev ${app2}
curl -s -o /dev/null -w "%{http_code}" localhost:8081
curl -s -o /dev/null -w "%{http_code}" localhost:5001
"""
}
}