@echo off
chcp 65001 >nul
echo ====================================
echo 期货智析平台 - Docker 部署脚本
echo ====================================
echo.

echo [1/4] 检查Docker环境...
docker --version >nul 2>&1
if errorlevel 1 (
    echo [错误] 未检测到Docker，请先安装Docker Desktop
    pause
    exit /b 1
)
echo [√] Docker已安装

echo.
echo [2/4] 停止并清理旧容器...
docker-compose down
echo [√] 清理完成

echo.
echo [3/4] 构建Docker镜像...
docker-compose build --no-cache
if errorlevel 1 (
    echo [错误] 镜像构建失败
    pause
    exit /b 1
)
echo [√] 镜像构建完成

echo.
echo [4/4] 启动Docker容器...
docker-compose up -d
if errorlevel 1 (
    echo [错误] 容器启动失败
    pause
    exit /b 1
)

echo.
echo ====================================
echo 部署完成！
echo ====================================
echo.
echo 访问地址: http://localhost:9600
echo 品种分析: http://localhost:9600/futures-analysis
echo API文档: http://localhost:9600/docs
echo 健康检查: http://localhost:9600/api/v1/health
echo.
echo 查看日志: docker-compose logs -f
echo 停止服务: docker-compose down
echo 重启服务: docker-compose restart
echo.
pause
