diff --git a/Jenkinsfile b/Jenkinsfile index 6027661..9194084 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -58,13 +58,15 @@ pipeline { stage('Deploy') { steps { script { - // Use sshagent in a script block sshagent([env.SSH_CRED]) { sh """ echo "🚀 Deploying to ${WEB_IP}..." - scp -o StrictHostKeyChecking=no build.tar.gz deploy@${WEB_IP}:/tmp/build.tar.gz - ssh -o StrictHostKeyChecking=no deploy@${WEB_IP} ' + # Copy build archive + scp -o StrictHostKeyChecking=no build.tar.gz ubuntu@${WEB_IP}:/tmp/build.tar.gz + + # Extract and deploy + ssh -o StrictHostKeyChecking=no ubuntu@${WEB_IP} ' sudo rm -rf /var/www/reactapp/* sudo mkdir -p /var/www/reactapp sudo tar -xzf /tmp/build.tar.gz -C /var/www/reactapp