compliance/verify-container-files.bat
2025-09-30 10:15:35 +08:00

76 lines
2.3 KiB
Batchfile

@echo off
echo === Verify Container Files ===
echo This script checks if the required files exist in the running container
echo.
REM Check if container is running
docker ps | findstr dms-compliance-tool >nul
if errorlevel 1 (
echo [ERROR] Container 'dms-compliance-tool' is not running
echo Please start the container first with start.bat
pause
exit /b 1
)
echo [INFO] Container is running, checking file structure...
echo.
echo [INFO] Checking working directory:
docker exec dms-compliance-tool pwd
echo.
echo [INFO] Checking app directory contents:
docker exec dms-compliance-tool ls -la /app/
echo.
echo [INFO] Checking if assets directory exists:
docker exec dms-compliance-tool ls -la /app/assets/ 2>nul
if errorlevel 1 (
echo [ERROR] Assets directory not found in container!
echo This is the cause of the API specification parsing error.
) else (
echo [SUCCESS] Assets directory found
)
echo.
echo [INFO] Checking DMS domain.json file:
docker exec dms-compliance-tool ls -la /app/assets/doc/dms/ 2>nul
if errorlevel 1 (
echo [ERROR] DMS directory not found in container!
) else (
echo [SUCCESS] DMS directory found
echo.
echo [INFO] Checking domain.json content:
docker exec dms-compliance-tool head -10 /app/assets/doc/dms/domain.json 2>nul
if errorlevel 1 (
echo [ERROR] domain.json file not found or not readable!
) else (
echo [SUCCESS] domain.json file is accessible
)
)
echo.
echo [INFO] Checking Python path and imports:
docker exec dms-compliance-tool python3 -c "import os; print('Current dir:', os.getcwd()); print('Assets exists:', os.path.exists('/app/assets/doc/dms/domain.json'))"
echo.
echo [INFO] Testing file access from Python:
docker exec dms-compliance-tool python3 -c "
try:
with open('/app/assets/doc/dms/domain.json', 'r') as f:
import json
data = json.load(f)
print('SUCCESS: domain.json loaded successfully')
print('Keys found:', len(data.keys()))
print('First key:', list(data.keys())[0] if data else 'None')
except Exception as e:
print('ERROR:', str(e))
"
echo.
echo === Verification Complete ===
echo If you see errors above, the container is missing required files.
echo Use fix-existing-package.bat to rebuild with the correct files.
echo.
pause