diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..921c999 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,52 @@ +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....' + + 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+' .' + } + } + 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 + } + } + } +} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..f67c767 --- /dev/null +++ b/package.json @@ -0,0 +1,6 @@ +{ + "name": "erp_manual", + "version": "0.0.1", + "description": "lexema erp docs" + } + \ No newline at end of file