Skip to content

Commit 8eb7209

Browse files
committed
Merge branch 'workflow_test'
2 parents 442f630 + 533318a commit 8eb7209

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

scripts/shutdown_container.bat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@echo off
2+
cd /d "%~dp0" || exit /b 3
3+
docker compose -f "../docker-compose.prod.yaml" down
4+
exit %RC% rem <- closes the cmd window created to run this BAT

scripts/startup_container.bat

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@echo off
2+
setlocal EnableExtensions EnableDelayedExpansion
3+
4+
rem === CONFIG ===
5+
set "DOCKER_PATH=C:\Program Files\Docker\Docker\Docker Desktop.exe"
6+
set "COMPOSE_FILE=../docker-compose.prod.yaml"
7+
rem === /CONFIG ===
8+
9+
rem Script's directory (always reliable, regardless of caller CWD)
10+
set "SCRIPT_DIR=%~dp0"
11+
12+
echo Script dir: "%SCRIPT_DIR%"
13+
echo Caller CWD: "%CD%"
14+
15+
rem Ensure the compose file exists (absolute path)
16+
if not exist "%SCRIPT_DIR%%COMPOSE_FILE%" (
17+
echo ERROR: "%SCRIPT_DIR%%COMPOSE_FILE%" not found.
18+
exit /b 2
19+
)
20+
21+
rem (Optional but nice) make Compose treat the project as if run from the script dir
22+
set "COMPOSE_PROJECT_DIR=%SCRIPT_DIR%"
23+
24+
rem Switch to the script dir (handles drive changes)
25+
cd /d "%SCRIPT_DIR%" || ( echo ERROR: cannot cd to "%SCRIPT_DIR%" & exit /b 3 )
26+
27+
rem --- 1) Ensure Docker Desktop is running ---
28+
tasklist /FI "IMAGENAME eq Docker Desktop.exe" | find /I "Docker Desktop.exe" >nul
29+
if errorlevel 1 (
30+
echo Starting Docker Desktop...
31+
start "" "%DOCKER_PATH%"
32+
) else (
33+
echo Docker Desktop is already running.
34+
)
35+
36+
rem --- 2) Wait for Docker engine to be ready ---
37+
echo Waiting for Docker Engine to start...
38+
:waitloop
39+
docker info >nul 2>&1 || ( timeout /t 2 /nobreak >nul & goto waitloop )
40+
echo Docker Engine is ready!
41+
42+
rem --- 3) Prefer docker compose (v2); fallback to docker-compose (v1) ---
43+
docker compose version >nul 2>&1
44+
if %ERRORLEVEL%==0 ( set "DC_CMD=docker compose" ) else ( set "DC_CMD=docker-compose" )
45+
46+
echo Using: %DC_CMD%
47+
echo Compose file: "%SCRIPT_DIR%%COMPOSE_FILE%"
48+
49+
rem --- 4) Bring the stack up (absolute -f path so caller CWD never matters) ---
50+
%DC_CMD% -f "%SCRIPT_DIR%%COMPOSE_FILE%" up
51+
set "RC=%ERRORLEVEL%"
52+
53+
if not "%RC%"=="0" (
54+
echo Compose failed with exit code %RC%.
55+
) else (
56+
echo Project started successfully.
57+
)
58+
59+
exit %RC% rem <- closes the cmd window created to run this BAT

0 commit comments

Comments
 (0)