ci4sManagement-cloud/k8s/build-node.sh

54 lines
963 B
Bash
Executable File

#!/bin/bash
# 设置参数变量
build_mode=""
# 解析命令行参数
while [[ $# -gt 0 ]]; do
case $1 in
-m)
build_mode="$2"
shift 2
;;
*)
echo "未知参数: $1"
exit 1
;;
esac
done
baseDir="/home/somuns/ci4s"
cd ${baseDir}/react-ui
npm config set registry https://registry.npmmirror.com/
#npm config set proxy http://172.20.32.253:3128
#npm config set https-proxy http://172.20.32.253:3128
npm install --force --verbose
if [ $? -ne 0 ]; then
echo "Failed to install npm depend package"
exit 1
fi
if [ "$build_mode" = "huoshi" ]; then
echo "前端带火石编译模式"
npm run build-with-huoshi
elif [ "$build_mode" = "no-huoshi" ]; then
echo "前端不带火石编排模式"
npm run build
else
echo "不匹配的前端模式,请检查参数"
exit 1
fi
if [ $? -ne 0 ]; then
echo "Failed to build react-ui"
exit 1
fi