feat: add deploy api script

This commit is contained in:
Oleg Proskurin 2025-12-23 22:08:06 +07:00
parent dbf9915bb8
commit b9c998f33d
2 changed files with 37 additions and 1 deletions

View File

@ -22,7 +22,8 @@
"format:check": "prettier --check \"apps/**/*.{ts,tsx,js,jsx,json,css,md}\" \"packages/**/*.{ts,tsx,js,jsx,json,css,md}\" \"*.{ts,tsx,js,jsx,json,css,md}\" --ignore-unknown",
"clean": "pnpm -r clean && rm -rf node_modules",
"deploy:landing": "./scripts/deploy-landing.sh",
"deploy:landing:no-cache": "./scripts/deploy-landing.sh --no-cache"
"deploy:landing:no-cache": "./scripts/deploy-landing.sh --no-cache",
"deploy:api": "./scripts/deploy-landing.sh"
},
"keywords": [
"monorepo",

35
scripts/deploy-api.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
set -e
echo "=== Banatie API Deployment ==="
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
# Pull latest code
echo "→ Pulling latest changes..."
cd "$PROJECT_DIR"
git pull
# Build
echo "→ Building API..."
cd /opt/banatie
BUILD_ARGS=""
if [[ "$1" == "--no-cache" ]]; then
echo " (using --no-cache)"
BUILD_ARGS="--no-cache"
fi
docker compose --env-file .env --env-file secrets.env build $BUILD_ARGS banatie-api
# Deploy
echo "→ Deploying..."
docker compose --env-file .env --env-file secrets.env up -d banatie-api
# Check
sleep 3
echo "→ Status:"
docker logs banatie-api --tail 5
echo "=== Done ==="