From 5ee75f88ddddd869efa31fdb83431ae89d2ecaa2 Mon Sep 17 00:00:00 2001 From: Nana Janashia Date: Wed, 18 Nov 2020 12:44:07 +0000 Subject: [PATCH] Update Jenkinsfile --- Jenkinsfile | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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