forked from careydevelopment/ecosystem-user-service
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
56 lines (48 loc) · 1.78 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
54
55
56
node {
def app
def image = 'careydevelopment/ecosystem-user-service'
def branch = scm.branches[0].name.substring(2)
try {
stage('Cleanup') {
sh 'sudo docker rm --force ecosystem-user-service || true'
sh 'sudo docker rmi --force ecosystem-user-service || true'
}
stage('Clone repository') {
git branch: branch,
credentialsId: 'GitHub Credentials',
url: 'https://github.com/careydevelopment/ecosystem-user-service.git'
}
stage('Copy properties files') {
sh 'cp ../config/ecosystem-user-service/application.properties ./src/main/resources'
//for recaptcha
sh 'cp ../config/ecosystem-user-service/carey-development-service-config.json .'
}
stage('Build JAR') {
docker.image('maven:3.6.3-jdk-11').inside('-v /root/.m2:/root/.m2') {
sh 'mvn -B clean package'
stash includes: '**/target/ecosystem-user-service.jar', name: 'jar'
}
}
stage('Build Image') {
unstash 'jar'
app = docker.build image
}
//stage('Push') {
// docker.withRegistry('https://registry.hub.docker.com', 'docker-hub') {
// app.push("${env.BUILD_NUMBER}")
// app.push("latest")
// }
//}
stage ('Docker Run') {
sh 'docker run -d -t -p 32010:32010 -v /etc/careydevelopment:/etc/careydevelopment --name ecosystem-user-service careydevelopment/ecosystem-user-service:latest'
}
} catch (e) {
echo 'Error occurred during build process!'
echo e.toString()
currentBuild.result = 'FAILURE'
} finally {
//skipping tests as we need environment setup (e.g., remote properties files)
//will get to it later
//junit '**/target/surefire-reports/TEST-*.xml'
}
}