pipeline { environment { registry = "hftstuttgart/modocot-backend" registryCredential = 'Dockerhub' dockerImage = '' } agent any tools { jdk 'Java11' maven 'Maven_Home' } stages { stage('Checkout') { steps { echo 'Checkout Repository..' git branch: 'master', url: 'https://transfer.hft-stuttgart.de/gitlab/HFTSoftwareProject/MoDoCoT-Backend.git' } } stage('Build') { steps { echo 'Maven Build..' sh 'mvn clean package -DskipTests=false' } } stage('Docker Build..') { steps{ script { dockerImage = docker.build registry + ":latest" } } } stage('Push to Dockerhub..') { steps{ script { docker.withRegistry( '', registryCredential ) { dockerImage.push() } } } } stage('ShellScript') { steps { echo 'Exectue Shellscript..' sh 'chmod 744 restart_modocot_backend.sh && ./restart_modocot_backend.sh' } } } }