Skip to content

Instantly share code, notes, and snippets.

@Tahooralisyed
Created May 19, 2020 06:01
Show Gist options
  • Save Tahooralisyed/a65e7bd41090ae45d70f5e11ebac46ef to your computer and use it in GitHub Desktop.
Save Tahooralisyed/a65e7bd41090ae45d70f5e11ebac46ef to your computer and use it in GitHub Desktop.
node{
stage('SCM Checkout'){
//svn credentialsId: 'svn_credentails', remote:'http://86.62.223.182:81/svn/holoteq/Mood_microservice/spring-web'
checkout([$class: 'SubversionSCM', filterChangelog: false, ignoreDirPropChanges: false, locations: [[cancelProcessOnExternalsFail: true, credentialsId: 'svn_credentails', depthOption: 'infinity', ignoreExternalsOption: true, local: '.', remote: 'http://86.62.223.182:81/svn/holoteq/Mood_microservice']], quietOperation: true, workspaceUpdater: [$class: 'UpdateUpdater']])
}
stage('Mvn Package'){
sh label: '', script: 'mvn clean install'
}
stage('Build Artifacts'){
archiveArtifacts artifacts: 'target/*war', followSymlinks: false
}
stage('Build Docker Image'){
//sh 'docker build -t 80071/mood_micro_service:1.0.1 .'
docker.withRegistry('', 'docker_id') {
def customImage = docker.build("80071/mood_micro_service:1.0.1")
/* Push the container to the custom Registry */
customImage.push()
}
//sh credentialsId: 'docker_id',build:'docker build -t 80071/mood_micro_service:1.0.0 .'
//step([$class: 'DockerBuilderPublisher', cleanImages: false, cleanupWithJenkinsJobDelete: false, cloud: '', dockerFileDirectory: 'Dockerfile', fromRegistry: [], pushCredentialsId: 'docker_hub', pushOnSuccess: true, tagsString: 'docker build -t 80071/mood_micro_service:1.0.0 .'])
}
stage('Run Docker container On Dev Server'){
input('Do you want to proceed for Deploy in Dev_Server?')
def DockerRun = 'docker run -p 9000:8080 -d 80071/mood_micro_service:1.0.1'
sshagent(['jenkins_server']) {
sh "ssh -o StrictHostKeyChecking=no ec2-user@15.185.37.57 ${DockerRun}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment