-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
52 lines (35 loc) · 1.43 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
pipeline {
agent any
stages {
stage('FrontEnd'){
steps {
dir('frontend/owo'){
script{
docker.build('front')
}
}
dir('frontend/owo'){
sh 'docker ps -f name=front -q | xargs --no-run-if-empty docker container stop'
sh 'docker container ls -a -f name=front -q | xargs -r docker container rm'
sh 'docker images --no-trunc --all --quiet --filter="dangling=true" | xargs --no-run-if-empty docker rmi'
sh 'docker run -d --privileged --name front -p 8080:8080 front:latest'
}
}
}
stage('BackEnd'){
steps {
dir('backend'){
script{
docker.build('backend')
}
}
dir('backend'){
sh 'docker ps -f name=backend -q | xargs --no-run-if-empty docker container stop'
sh 'docker container ls -a -f name=backend -q | xargs -r docker container rm'
sh 'docker images --no-trunc --all --quiet --filter="dangling=true" | xargs --no-run-if-empty docker rmi'
sh 'docker run -d --privileged --name backend -p 8282:8282 backend:latest'
}
}
}
}
}