#!/bin/bash
BUILD_ID=dontKillMe

pwd
currentLocation=$(pwd)
echo $currentLocation

echo "刪除舊的文件"
rm -rf dist.zip

echo "開始編譯"
npm install
npm run build:prod

echo "打包壓縮包"
zip -r dist.zip dist/*

mkdir -p /var/www/web_houtai-manage-jiegou
cd /var/www/web_houtai-manage-jiegou

rm -rf /var/www/web_houtai-manage-jiegou/*

echo "拷貝包"
cp $currentLocation/dist.zip /var/www/web_houtai-manage-jiegou/

echo "開始解壓了"
unzip dist.zip
chmod -R 777 /var/www/web_houtai-manage-jiegou
