Commit bb4089d3 authored by bill lin's avatar bill lin

lsdfhsldsl

parent caf73282
pipeline { pipeline {
agent { agent {
docker { docker {
image 'maven:3.3.9' image 'maven:3.3.9'
args '-v /root/jenkins/data/mvn/settings.xml:/usr/share/maven/conf/settings.xml -v /root/jenkins/data/mvn/maven-repo:/data/maven-repo -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -u root:994' args '-v /root/jenkins/data/mvn/settings.xml:/usr/share/maven/conf/settings.xml -v /root/jenkins/data/mvn/maven-repo:/data/maven-repo -v /var/run/docker.sock:/var/run/docker.sock -v /usr/bin/docker:/usr/bin/docker -u root:994'
} }
} }
stages { stages {
stage('BUILD IMAGE') { stage('Build') {
steps { steps {
sh ''' sh '''
docker build -t $registry_address/$image_name:latest .''' mvn -B -DskipTests clean package
} '''
} }
stage('PUSH IMAGE') {
steps {
sh '''docker login -u deployment -p deployment123 nexus.gsstcloud.com:8093
docker push $registry_address/$image_name:latest
ssh -o "StrictHostKeyChecking no" root@192.168.12.47 date '''
} }
} }
stage('REMOVE LOCAL IMAGE') { }
steps { \ No newline at end of file
sh '''docker rmi -f $registry_address/$image_name:latest'''
}
}
stage('Cleanup') {
steps {
cleanWs(deleteDirs: true)
}
}
}
environment {
registry_address = 'nexus.gsstcloud.com:8093/test'
image_name = 'lxnginx'
app_server_sit = '192.168.12.47'
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment