1+ @ echo off
2+ setlocal enabledelayedexpansion
3+
4+ echo AI MultiBarcode Capture - Web Server Update
5+ echo =============================================
6+ echo This script updates the website files in the Docker container
7+
8+ REM Check if Docker container exists
9+ docker ps -a -q -f name=multibarcode-webinterface > nul 2 >& 1
10+ if errorlevel 1 (
11+ echo [ERROR] Docker container 'multibarcode-webinterface' does not exist
12+ echo Please run start-services.bat first to create the container
13+ pause
14+ exit /b 1
15+ )
16+
17+ REM Check if container is running
18+ docker ps -q -f name=multibarcode-webinterface > nul 2 >& 1
19+ if errorlevel 1 (
20+ echo [INFO] Container exists but is not running, starting it...
21+ docker start multibarcode-webinterface
22+ if errorlevel 1 (
23+ echo [ERROR] Failed to start container
24+ pause
25+ exit /b 1
26+ )
27+ echo [OK] Container started successfully
28+ echo Waiting for services to initialize...
29+ timeout /t 10 /nobreak > nul
30+ ) else (
31+ echo [OK] Container is running
32+ )
33+
34+ echo .
35+ echo [STEP 1] Copying website files to container...
36+
37+ REM Copy main website files
38+ docker cp src\index.html multibarcode-webinterface:/var/www/html/
39+ docker cp src\css multibarcode-webinterface:/var/www/html/
40+ docker cp src\js multibarcode-webinterface:/var/www/html/
41+ docker cp src\lang multibarcode-webinterface:/var/www/html/
42+ docker cp src\lib multibarcode-webinterface:/var/www/html/
43+
44+ echo [STEP 2] Copying API files...
45+ docker cp src\api multibarcode-webinterface:/var/www/html/
46+
47+ echo [STEP 3] Copying configuration files...
48+ docker cp src\config multibarcode-webinterface:/var/www/html/
49+
50+ echo [STEP 4] Setting proper permissions...
51+ docker exec multibarcode-webinterface bash -c " chown -R www-data:www-data /var/www/html"
52+ docker exec multibarcode-webinterface bash -c " chmod -R 755 /var/www/html"
53+
54+ echo [STEP 5] Reloading Apache configuration...
55+ docker exec multibarcode-webinterface bash -c " service apache2 reload"
56+
57+ if %errorlevel% equ 0 (
58+ echo .
59+ echo =============================================
60+ echo [SUCCESS] Web server updated successfully!
61+ echo =============================================
62+ echo .
63+ echo The website has been updated with the latest files.
64+ echo You can access it at: http://localhost:3500
65+ echo .
66+ ) else (
67+ echo [ERROR] Failed to reload Apache configuration
68+ pause
69+ exit /b 1
70+ )
71+
72+ echo Update completed successfully!
73+ pause
0 commit comments