-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
31 lines (30 loc) · 930 Bytes
/
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
pipeline {
agent any
environment {
WS = "${WORKSPACE}"
}
stages {
stage('compile') {
agent {
docker {
image 'maven:3-alpine'
args '-v /root/.m2:/root/.m2 -u root'
}
}
steps {
sh 'cd ${WS} && mvn clean package -s "/root/.m2/settings.xml" -Dmaven.skip.Tests=true'
}
}
stage('Build') {
steps {
sh 'docker build -t chatServer:${BUILD_NUMBER} .'
}
}
stage('Deploy') {
steps {
sh 'if [[ -n $(docker ps -q -f "name=chatServer") ]];then docker rm -f "chatServer"; else echo "container not exist"; fi'
sh 'docker run -d -u root -p 10800:10800 --name chatServer -v /usr/local/chat_upload:/upload chatServer:${BUILD_NUMBER}'
}
}
}
}