-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
22 lines (22 loc) · 866 Bytes
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
node {
def WORKSPACE = "/var/lib/jenkins/workspace/Myticket_Admin"
def dockerImageTag = "myticket-fo-deploy${env.BUILD_NUMBER}"
try{
stage('Clone Repo') {
git url: 'https://github.com/Sipoufo/myticketadmin.git',
credentialsId: 'myticket_ssh',
branch: 'master'
sh 'npm install'
}
stage('Build docker') {
dockerImage = docker.build("myticket-admin-deploy:${env.BUILD_NUMBER}")
}
stage('Deploy docker'){
echo "Docker Image Tag Name: ${dockerImageTag}"
sh "docker stop myticket-admin-deploy || true && docker rm myticket-admin-deploy || true"
sh "docker run --net=host --name myticket-admin-deploy -d -p 3200:3200 myticket-admin-deploy:${env.BUILD_NUMBER}"
}
}catch(e){
throw e
}
}