-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
53 lines (53 loc) · 1.21 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
48
49
50
51
52
53
pipeline {
agent any
stages {
stage('get code') {
agent any
steps {
sh '''echo "delete workspace"
rm -rf ./*
echo "get code"
git clone [email protected]:monitor
'''
}
}
stage('code build') {
steps {
sh '''tar -zvcf /data/$BUILD_TAG.tar.gz ./*
'''
}
}
stage('push code') {
steps {
sh '''rm -rf /dockerweb
cd /data/ && tar -zvxf /data/$BUILD_TAG.tar.gz
'''
}
}
stage('nginx-lbdocker') {
steps {
sh '''docker rm -f `docker ps -aq`
docker run -d --name nginx-lb -p 80:80 -v /docker/conf.d/lb.conf:/etc/nginx/conf.d/default.conf nginx:latest'''
}
}
stage('nginx-rs') {
parallel {
stage('nginx-rs-01') {
steps {
sh 'docker run -d --name nginx-rs-01 -v /data/monitor:/usr/share/nginx/html nginx:latest'
}
}
stage('nginx-rs02') {
steps {
sh 'docker run -d --name nginx-rs-02 -v /data/monitor:/usr/share/nginx/html nginx:latest'
}
}
stage('nginx-rs03') {
steps {
sh 'docker run -d --name nginx-rs-03 -v /data/monitor:/usr/share/nginx/html nginx:latest'
}
}
}
}
}
}