38 lines
1.0 KiB
Batchfile
38 lines
1.0 KiB
Batchfile
@echo off
|
|
setlocal EnableDelayedExpansion
|
|
cd /d "%~dp0.."
|
|
|
|
REM ============================================================
|
|
REM 本机构建并推送镜像;服务器只 docker compose pull && up -d
|
|
REM 用法:
|
|
REM deploy\build-push.bat
|
|
REM set RECORD_BOT_IMAGE=youruser/record-bot:1.0.1 && deploy\build-push.bat
|
|
REM ============================================================
|
|
|
|
if "%RECORD_BOT_IMAGE%"=="" (
|
|
echo Set RECORD_BOT_IMAGE first, e.g.:
|
|
echo set RECORD_BOT_IMAGE=youruser/record-bot:latest
|
|
echo deploy\build-push.bat
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo === Build record-bot → %RECORD_BOT_IMAGE% ===
|
|
docker build -t "%RECORD_BOT_IMAGE%" -f record-bot\Dockerfile record-bot
|
|
if errorlevel 1 exit /b 1
|
|
|
|
echo.
|
|
echo === Push %RECORD_BOT_IMAGE% ===
|
|
docker push "%RECORD_BOT_IMAGE%"
|
|
if errorlevel 1 (
|
|
echo Push failed. Login first: docker login
|
|
exit /b 1
|
|
)
|
|
|
|
echo.
|
|
echo OK. On server:
|
|
echo docker compose -f record-bot.compose.yaml pull
|
|
echo docker compose -f record-bot.compose.yaml up -d
|
|
echo Or in 1Panel: 重建/拉取镜像后重启容器。
|
|
endlocal
|