|
@@ -1,16 +1,19 @@
|
|
|
pipeline {
|
|
|
agent any
|
|
|
+ environment {
|
|
|
+ BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
|
|
|
+ }
|
|
|
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'
|
|
|
+ sh 'docker-compose down'
|
|
|
+ nodejs('16.19.0') {
|
|
|
+ sh 'npm install yarn -g --registry https://registry.npm.taobao.org'
|
|
|
+ sh 'yarn config set registry https://registry.npm.taobao.org/'
|
|
|
+ sh 'yarn install'
|
|
|
+ sh 'yarn run build:prod'
|
|
|
+ }
|
|
|
+ sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
|
|
|
}
|
|
|
}
|
|
|
stage('Test') {
|
|
@@ -19,12 +22,8 @@ pipeline {
|
|
|
}
|
|
|
}
|
|
|
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'
|
|
|
}
|
|
|
}
|