Jenkinsfile 948 B

12345678910111213141516171819202122232425262728293031323334
  1. pipeline {
  2. agent any
  3. environment {
  4. BRANCH_NAME="${env.BRANCH_NAME}".toLowerCase()
  5. }
  6. stages {
  7. stage('Build') {
  8. steps {
  9. sh 'docker-compose down'
  10. nodejs('16.17.0') {
  11. sh 'npm -v'
  12. sh 'node -v'
  13. sh 'yarn -v'
  14. sh 'npm install yarn -g --registry https://registry.npm.taobao.org'
  15. sh 'yarn config set registry https://registry.npm.taobao.org/'
  16. sh 'yarn install'
  17. sh 'yarn run build:prod'
  18. }
  19. sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
  20. }
  21. }
  22. stage('Test') {
  23. steps {
  24. echo 'Testing..'
  25. }
  26. }
  27. stage('Deploy') {
  28. steps {
  29. echo 'Deploying....'
  30. sh 'docker-compose up -d'
  31. }
  32. }
  33. }
  34. }