Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node {
- def app
- def local_container_name = "some-container-name"
- def dockerhub_container = "user/${local_container_name}"
- # So I can turn down old image and turn up new
- def docker_compose_path = "/path/to/docker-compose/"
- stage('Clone Repository') {
- checkout scm
- }
- stage('Build Image') {
- app = docker.build("${dockerhub_container}")
- }
- stage('Test Image') {
- # This allows you to run sh commands inside the container
- app.inside {
- sh 'echo "Volkswagen Tests passed"'
- }
- }
- stage('Push Image To Docker Hub') {
- docker.withRegistry('https://registry.hub.docker.com', 'docker-hub-credentials') {
- app.push("${env.BUILD_NUMBER}")
- app.push("latest")
- }
- }
- stage ('SSH To Docker Host and Deploy') {
- sshagent(credentials : ['my-ssh-creds']) {
- sh '''
- SSH to@host <<EOF
- A Bunch Of SSH Commands
- EOF
- '''
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement