Files
kondiplo_front/script/deploy_dip_api.sh

38 lines
1.0 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# ==================================================
# dip_api (FastAPI) のビルド・起動スクリプト
# VPS上で実行
# ==================================================
set -e
# dip_api のソースコードがある場所VPSにコピー後
DIP_API_DIR="${1:-/home/kontei/dip_api}"
echo "=== dip_api Docker イメージのビルド ==="
cd "$DIP_API_DIR"
docker build -t dip-api:latest .
echo ""
echo "=== 既存コンテナの停止・削除(ある場合) ==="
docker stop dip-api 2>/dev/null || true
docker rm dip-api 2>/dev/null || true
echo ""
echo "=== dip_api コンテナの起動 ==="
docker run -d \
--name dip-api \
--restart always \
-p 8000:8000 \
dip-api:latest
echo ""
echo "=== ヘルスチェック ==="
sleep 3
if curl -s http://localhost:8000/debug/heartbeat > /dev/null 2>&1; then
echo "✅ dip_api は正常に起動しています"
else
echo "⚠️ dip_api の起動を確認中... (数秒待ってから再確認してください)"
echo " docker logs dip-api で確認"
fi