feat: add deploy api script
This commit is contained in:
parent
dbf9915bb8
commit
b9c998f33d
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 ==="
|
||||
Loading…
Reference in New Issue