#!/bin/bash
set -e

cd "$(dirname "$0")"

echo "=== KeinaSystem デプロイ ==="

echo "[1/4] git pull..."
git pull origin main

echo "[2/4] docker compose down..."
docker compose down

echo "[3/4] docker compose build..."
docker compose build

echo "[4/5] docker compose up -d..."
docker compose up -d

echo "[5/5] migrate..."
docker compose exec backend python manage.py migrate

echo ""
echo "=== デプロイ完了 ==="
docker compose ps
