deployment.sh 828 B

1234567891011121314151617181920
  1. #!/bin/bash
  2. # 执行命令
  3. current_git_branch_latest_short_id=`git rev-parse --short HEAD`
  4. version=$(grep '"version"' package.json | sed -E 's/.*"version": "([^"]+)".*/\1/')
  5. project_name=$(grep '"name"' package.json | sed -E 's/.*"name": "([^"]+)".*/\1/')
  6. # docker_name="$project_name:$version-$current_git_branch_latest_short_id"
  7. docker_name="new_cash_book_node:$version-$current_git_branch_latest_short_id"
  8. save_file_name="new_cash_book_node_$version-$current_git_branch_latest_short_id.tar"
  9. # 执行命令
  10. cd ./frontEndMobile
  11. yarn install --registry=https://registry.npmmirror.com && npm run build
  12. rm -rf ../node_expores/public
  13. cp -rf ./dist ../node_expores/public
  14. cd ../node_expores
  15. yarn install --registry=https://registry.npmmirror.com
  16. docker build -t $docker_name .
  17. cd ../
  18. docker save -o ./$save_file_name $docker_name