diff --git a/Jenkinsfile b/Jenkinsfile index f07d1d5..33682a5 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,3 +1,5 @@ +#!/usr/bin/env groovy + pipeline { agent any stages { @@ -10,17 +12,20 @@ pipeline { } stage('build') { steps { - script { - echo "Building the application..." + script { + echo "Building the application..." } } } stage('deploy') { steps { script { - echo "Deploying the application..." + def dockerCmd = 'docker run -p 3080:3080 -d nanajanashia/demo-app:1.0' + sshagent(['ec2-server-key']) { + sh "ssh -o StrictHostKeyChecking=no ec2-user@35.180.251.121 ${dockerCmd}" + } } } } } -} +} \ No newline at end of file