Jenkinsfile 850 B

12345678910111213141516171819202122232425262728293031
  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.19.0') {
  11. sh 'npm install yarn -g --registry https://registry.npm.taobao.org'
  12. sh 'yarn config set registry https://registry.npm.taobao.org/'
  13. sh 'yarn install'
  14. sh 'yarn run build:prod'
  15. }
  16. sh 'docker build -t ${BRANCH_NAME}:${BUILD_NUMBER} .'
  17. }
  18. }
  19. stage('Test') {
  20. steps {
  21. echo 'Testing..'
  22. }
  23. }
  24. stage('Deploy') {
  25. steps {
  26. echo 'Deploying....'
  27. sh 'docker-compose up -d'
  28. }
  29. }
  30. }
  31. }