#!/bin/bash set -e LOG=/var/log/bssapp_deploy.log exec >> $LOG 2>&1 echo "==============================" echo "🚀 DEPLOY START $(date)" echo "==============================" cd /opt/bssapp echo "== STOP SERVICE ==" systemctl stop bssapp || true echo "== GIT SYNC ==" git fetch origin git reset --hard origin/master git clean -fdx echo "== BUILD UI ==" cd ui npm install npm run build cd .. echo "== COPY UI ==" rm -rf svc/public/* cp -r ui/dist/spa/* svc/public/ echo "== BUILD BACKEND ==" cd svc go build -o bssapp cd .. echo "== START SERVICE ==" systemctl start bssapp echo "✅ DEPLOY DONE $(date)"