-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
38 lines (38 loc) · 1.17 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
pipeline {
environment {
registry = 'archguard/document_app'
registryCredential = 'DockerHubCredentials'
dockerImage = ''
dev_env = 'ag-dev'
qa_env = 'ag-qa'
uat_env = 'ag-uat'
prod_env = 'ag-prod'
}
agent any
stages {
stage('Build') {
steps {
sh '''
./gradlew clean build
'''
}
}
stage('Build Image') {
steps{
script {
dockerImage = docker.build(registry)
docker.withRegistry('https://registry.hub.docker.com', registryCredential ) {
dockerImage.push()
}
}
}
}
stage('Deploy') {
steps {
sh 'curl -sSL http://ec2-68-79-38-105.cn-northwest-1.compute.amazonaws.com.cn:8080/job/DeployFiles/lastSuccessfulBuild/artifact/docker-compose.yml --output docker-compose.yml'
sh 'docker-compose -p archguard -f docker-compose.yml pull'
sh 'docker-compose -p archguard -f docker-compose.yml up -d'
}
}
}
}