pipeline {
    agent any
    environment {
        BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
    }
    stages {
        stage('Build') {
            steps {
                nodejs('20.6.0') {
										sh 'npm install -g pnpm --registry https://registry.npm.taobao.org'
                    sh 'pnpm install --registry https://registry.npm.taobao.org'
                    sh 'pnpm build:dev'
                }
                sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing..'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying....'
                sh 'docker-compose up -d'
            }
        }
    }
}
