.gitlab-ci.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. stages:
  2. - build
  3. - deploy
  4. # mvn打包
  5. build:
  6. stage: build
  7. only:
  8. - dev_01
  9. script:
  10. - $MAVEN_HOME/bin/mvn clean package '-Dmaven.test.skip=true'
  11. - cp ./vctgo-auth/target/vctgo-auth.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/auth/jar/
  12. - cp ./vctgo-gateway/target/vctgo-gateway.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/gateway/jar/
  13. - cp ./vctgo-modules/vctgo-file/target/vctgo-file.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/file/jar/
  14. - cp ./vctgo-modules/vctgo-system/target/vctgo-system.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/system/jar/
  15. - cp ./vctgo-modules/jnrz-toy/target/jnrz-toy.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/toy/jar/
  16. - cp ./vctgo-modules/jnrz-book/target/jnrz-book.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/book/jar/
  17. - cp ./vctgo-modules/jnrz-activity/target/jnrz-activity.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/activity/jar/
  18. #- cp ./vctgo-modules/jnrz-process/target/jnrz-process.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/process/jar/
  19. #- cp ./vctgo-modules/jnrz-message/target/jnrz-message.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/message/jar/
  20. - cp ./vctgo-modules/jnrz-profile/target/jnrz-profile.jar /usr/local/jnrz-service-saas-multi-tenant/docker/vctgo/modules/profile/jar/
  21. - rm -rf /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/platform/
  22. - docker exec npmtools bash -c 'cd vctgo-ui && rm -rf `ls | grep -v "node_modules"`'
  23. - docker cp ./vctgo-ui npmtools:/
  24. - docker exec npmtools bash -c "cd vctgo-ui && npm i && export NODE_OPTIONS=--openssl-legacy-provider && npm run build:test"
  25. - docker cp npmtools:/vctgo-ui/dist/ /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/platform
  26. - rm -rf /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/kindergarten/
  27. - docker exec npmtools bash -c 'cd vctgo-ui-kindergarten && rm -rf `ls | grep -v "node_modules"`'
  28. - docker cp ./vctgo-ui-kindergarten npmtools:/
  29. - docker exec npmtools bash -c "cd vctgo-ui-kindergarten && npm i && export NODE_OPTIONS=--openssl-legacy-provider && npm run build:test"
  30. - docker cp npmtools:/vctgo-ui-kindergarten/dist/ /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/kindergarten
  31. #- rm -rf /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/expert/
  32. #- docker exec npmtools bash -c 'cd vctgo-ui-expert && rm -rf `ls | grep -v "node_modules"`'
  33. #- docker cp ./vctgo-ui-expert npmtools:/
  34. #- docker exec npmtools bash -c "cd vctgo-ui-expert && npm i && export NODE_OPTIONS=--openssl-legacy-provider && npm run build:test"
  35. #- docker cp npmtools:/vctgo-ui-expert/dist/ /usr/local/jnrz-service-saas-multi-tenant/docker/nginx/html/expert
  36. tags:
  37. - test-ci/cd
  38. # 部署测试服务器
  39. deploy:
  40. stage: deploy
  41. only:
  42. - dev_01
  43. script:
  44. - cd /usr/local/jnrz-service-saas-multi-tenant/docker
  45. - /usr/local/bin/docker-compose down
  46. - docker tag node:latest docker_jnrz_system:latest
  47. - docker rmi $(docker images | grep docker_ | awk '{print $1}')
  48. - docker rmi nginx:latest
  49. - docker rmi mysql:5.7
  50. - /usr/local/bin/docker-compose up -d vctgo-mysql vctgo-redis vctgo-nacos
  51. # - /usr/local/bin/docker-compose up -d vctgo-nginx vctgo-gateway vctgo-auth vctgo-system vctgo-file jnrz-toy jnrz-activity jnrz-process jnrz-message jnrz-profile
  52. - /usr/local/bin/docker-compose up -d vctgo-nginx vctgo-gateway vctgo-auth vctgo-system vctgo-file jnrz-toy jnrz-activity jnrz-profile jnrz-book
  53. - docker system prune -f
  54. - docker volume prune -f
  55. tags:
  56. - test-ci/cd