|
|
@@ -1,31 +1,44 @@
|
|
|
node {
|
|
|
try {
|
|
|
+ environment {
|
|
|
+ registry = "10.2.200.235:50006"
|
|
|
+ registryCredential = 'localregistry'
|
|
|
+ }
|
|
|
+
|
|
|
stage('Checkout') {
|
|
|
checkout scm
|
|
|
}
|
|
|
+
|
|
|
stage('Initialize'){
|
|
|
def dockerHome = tool 'myDocker'
|
|
|
env.PATH = "${dockerHome}/bin:${env.PATH}"
|
|
|
}
|
|
|
+
|
|
|
stage('Environment') {
|
|
|
sh 'git --version'
|
|
|
echo "Branch: master"
|
|
|
sh 'docker -v'
|
|
|
sh 'printenv'
|
|
|
}
|
|
|
+
|
|
|
stage('Build Docker test'){
|
|
|
sh 'docker build -t ptb-fe -f Dockerfile .'
|
|
|
}
|
|
|
+
|
|
|
stage('Deploy'){
|
|
|
if(env.BRANCH_NAME == 'master'){
|
|
|
- sh 'docker build -t ptb-fe .'
|
|
|
- sh 'docker tag ptb-fe localhost:50006/ptb-fe'
|
|
|
- sh 'docker push localhost:50006/ptb-fe'
|
|
|
- sh 'docker rmi -f ptb-fe localhost:50006/ptb-fe'
|
|
|
+ steps{
|
|
|
+ script {
|
|
|
+ dockerImage = docker.build registry + ":$BUILD_NUMBER"
|
|
|
+ docker.withRegistry( '', registryCredential ) {
|
|
|
+ dockerImage.push()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
+
|
|
|
catch (err) {
|
|
|
throw err
|
|
|
}
|
|
|
-}
|
|
|
+}
|