pipeline {
    agent any
    stages {
        stage('Install') {
            steps {
                sh 'npm install'
            }
        }
        stage('Build') {
            steps {
                sh 'npm run build'
            }
        }
        stage('Deploy') {
            steps {
                sshagent(['fymio']) {
                    sh 'scp -o StrictHostKeyChecking=no -r dist/* fymio@172.17.0.1:/var/www/fymio.us/'
                }
            }
        }
    }
    post {
        failure { echo 'Deployment failed!' }
        success { echo 'Deployment successful!' }
    }
}
