DocERP/Jenkinsfile

52 lines
1.5 KiB
Plaintext
Raw Normal View History

2022-10-25 05:14:05 +00:00
node {
checkout scm
docker_tag = 'latest'
projectname ='app'
packagejson = readJSON file: 'package.json'
docker_tag = packagejson['version']
projectname = packagejson['name']
}
pipeline {
agent any
options {
timestamps()
buildDiscarder logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '10')
ansiColor('xterm')
}
stages {
stage('Check') {
steps {
echo 'Checking..'
sh label: '', script: 'docker --version'
//sh "printenv | sort"
}
}
stage('Docker build') {
steps {
echo 'Docker build....'
2023-11-24 11:11:59 +00:00
sh label: '', script: 'docker build -f ./docker/Dockerfile --build-arg docker_registry=dhub.lex.lan:5000 -t dhub.lex.lan:5001/app/'+projectname+':'+docker_tag+' --no-cache .'
2022-10-25 05:14:05 +00:00
}
}
stage('docker push'){
steps {
script {
docker.withRegistry('http://dhub.lex.lan:5001/', '6173afa3-27b0-4357-8b97-9d1ee071784c') {
docker.image("dhub.lex.lan:5001/app/"+projectname+":${docker_tag}").push()
}
}
}
}
stage('docker cleanup'){
steps {
sh label: '', script: 'docker rmi dhub.lex.lan:5001/app/'+projectname+':'+docker_tag
}
}
}
}