101 lines
2.4 KiB
Batchfile
101 lines
2.4 KiB
Batchfile
@echo off
|
|
setlocal enabledelayedexpansion
|
|
|
|
echo === Debug Windows Script ===
|
|
echo.
|
|
|
|
REM Test variable handling
|
|
set "SELECTED_PORTS=5050,5051"
|
|
set "TARGET_PLATFORM=linux/amd64"
|
|
set "IMAGE_NAME=test-image"
|
|
set "EXPORT_DIR=test-dir"
|
|
|
|
echo [DEBUG] Testing variable values:
|
|
echo SELECTED_PORTS = !SELECTED_PORTS!
|
|
echo TARGET_PLATFORM = !TARGET_PLATFORM!
|
|
echo IMAGE_NAME = !IMAGE_NAME!
|
|
echo EXPORT_DIR = !EXPORT_DIR!
|
|
echo.
|
|
|
|
REM Test port extraction
|
|
echo [DEBUG] Testing port extraction:
|
|
for /f "tokens=1 delims=," %%a in ("!SELECTED_PORTS!") do (
|
|
set "PRIMARY_PORT=%%a"
|
|
echo PRIMARY_PORT = !PRIMARY_PORT!
|
|
)
|
|
echo.
|
|
|
|
REM Create test directory
|
|
if not exist "!EXPORT_DIR!" mkdir "!EXPORT_DIR!"
|
|
|
|
REM Test Docker Compose creation
|
|
echo [DEBUG] Testing Docker Compose creation:
|
|
call :test_compose_creation
|
|
|
|
echo.
|
|
echo [DEBUG] Checking created file:
|
|
if exist "!EXPORT_DIR!\docker-compose.yml" (
|
|
echo [SUCCESS] docker-compose.yml created
|
|
echo [INFO] File contents:
|
|
type "!EXPORT_DIR!\docker-compose.yml"
|
|
) else (
|
|
echo [ERROR] docker-compose.yml not created
|
|
)
|
|
|
|
REM Cleanup
|
|
if exist "!EXPORT_DIR!" rmdir /s /q "!EXPORT_DIR!"
|
|
|
|
echo.
|
|
echo Debug complete!
|
|
pause
|
|
exit /b 0
|
|
|
|
:test_compose_creation
|
|
setlocal enabledelayedexpansion
|
|
echo [DEBUG] Inside test_compose_creation subroutine
|
|
echo [DEBUG] SELECTED_PORTS = !SELECTED_PORTS!
|
|
echo [DEBUG] TARGET_PLATFORM = !TARGET_PLATFORM!
|
|
echo [DEBUG] IMAGE_NAME = !IMAGE_NAME!
|
|
echo [DEBUG] EXPORT_DIR = !EXPORT_DIR!
|
|
|
|
for /f "tokens=1 delims=," %%a in ("!SELECTED_PORTS!") do set "PRIMARY_PORT=%%a"
|
|
echo [DEBUG] PRIMARY_PORT = !PRIMARY_PORT!
|
|
|
|
(
|
|
echo services:
|
|
echo dms-compliance:
|
|
echo build:
|
|
echo context: .
|
|
echo dockerfile: Dockerfile
|
|
echo platforms:
|
|
echo - !TARGET_PLATFORM!
|
|
echo image: !IMAGE_NAME!:latest
|
|
echo container_name: dms-compliance-tool
|
|
echo ports:
|
|
echo - "!PRIMARY_PORT!:!PRIMARY_PORT!"
|
|
echo environment:
|
|
echo - PYTHONPATH=/app
|
|
echo - TZ=Asia/Shanghai
|
|
echo - PYTHONUNBUFFERED=1
|
|
echo volumes:
|
|
echo - ./uploads:/app/uploads
|
|
echo - ./logs:/app/logs
|
|
echo - ./reports:/app/reports
|
|
echo restart: unless-stopped
|
|
echo networks:
|
|
echo - dms-network
|
|
echo.
|
|
echo networks:
|
|
echo dms-network:
|
|
echo driver: bridge
|
|
echo.
|
|
echo volumes:
|
|
echo uploads:
|
|
echo logs:
|
|
echo reports:
|
|
) > "!EXPORT_DIR!\docker-compose.yml"
|
|
|
|
echo [DEBUG] Docker Compose file creation attempted
|
|
endlocal
|
|
goto :eof
|