pipeline { agent any stages { stage('Build') { agent { docker { image 'node:16-alpine' } } steps { sh 'docker-compose down' sh 'npm install --registry https://registry.npm.taobao.org' sh 'npm run build:prod' } } stage('Test') { steps { echo 'Testing..' } } stage('Deploy') { environment { BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase() } steps { echo 'Deploying....' sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .' sh 'docker-compose up -d' } } } }