From e19538c220ed605a3c228075f7ed05493cfa7cd2 Mon Sep 17 00:00:00 2001 From: Ishlah Muhammadi Date: Fri, 28 Jul 2023 16:24:41 +0700 Subject: [PATCH] Edit deploy stage #6 --- Jenkinsfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index b20f7402e..ad49d076a 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -25,7 +25,10 @@ node { checkout scm sshagent(['ec2-server-key']) { sh "ssh -o StrictHostKeyChecking=no ubuntu@13.212.240.207 sudo docker pull slehmadi/react-app-cicd-dicoding" - sh "ssh -o StrictHostKeyChecking=no ubuntu@13.212.240.207 sudo docker run -p 3000:3000 -d slehmadi/react-app-cicd-dicoding" + sh "ssh -o StrictHostKeyChecking=no ubuntu@13.212.240.207 sudo docker run --rm -d --name webserver -p 3000:3000 slehmadi/react-app-cicd-dicoding npm run start" + sh "echo deploy has been deployed for 1 minute" + sh "ssh -o StrictHostKeyChecking=no ubuntu@13.212.240.207 sudo docker stop webserver" + sh "ssh -o StrictHostKeyChecking=no ubuntu@13.212.240.207 sudo docker rmi slehmadi/react-app-cicd-dicoding" } } } \ No newline at end of file