-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.groovy
50 lines (43 loc) · 1.54 KB
/
Jenkinsfile.groovy
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
pipeline {
agent any
options {
skipDefaultCheckout(true)
}
stages {
stage ("deploy") {
parallel {
stage ('docker frontend run') {
steps {
echo 'git pull'
git branch: 'develop', credentialsId: 'admin', url: 'https://lab.ssafy.com/s08-final/S08P31C103.git'
echo 'frontend container, image remove'
sh 'pwd'
sh 'docker container prune -f'
sh 'docker image prune -af'
echo 'frontend build and up'
sh 'docker-compose up --build -d frontend'
}
}
stage ('docker backend run') {
steps {
sshagent (credentials: ['ssh_admin']) {
sh """
ssh -o StrictHostKeyChecking=no ${TARGET_HOST} '
cd /home/S08P31C103/
sudo git pull origin develop
sudo docker container prune -f
sudo docker image prune -af
sudo docker-compose build backend
sudo docker-compose up -d backend
'
"""
}
}
}
}
}
}
environment {
TARGET_HOST = "ubuntu@18.118.212.73"
}
}