forked from OBrink/DECIMER.ai
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild-windows.bat
More file actions
126 lines (111 loc) · 3.31 KB
/
build-windows.bat
File metadata and controls
126 lines (111 loc) · 3.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@echo off
SETLOCAL EnableDelayedExpansion
echo ==========================================
echo DECIMER Windows Production Build
echo ==========================================
REM Check Docker is running
docker --version >nul 2>&1
if %ERRORLEVEL% NEQ 0 (
echo ERROR: Docker is not running or not installed
echo Please start Docker Desktop and try again
pause
exit /b 1
)
REM Stop existing containers
echo.
echo [1/7] Stopping existing containers...
docker-compose -f docker-compose.windows.yml down
REM Clean up
echo [2/7] Cleaning up local files...
if exist .env del /f .env 2>nul
if exist public\storage del /f /q public\storage 2>nul
if exist bootstrap\cache rd /s /q bootstrap\cache 2>nul
if exist storage\framework\cache rd /s /q storage\framework\cache 2>nul
if exist storage\framework\sessions rd /s /q storage\framework\sessions 2>nul
if exist storage\framework\views rd /s /q storage\framework\views 2>nul
REM Recreate directories
mkdir bootstrap\cache 2>nul
mkdir storage\framework\cache\data 2>nul
mkdir storage\framework\sessions 2>nul
mkdir storage\framework\views 2>nul
REM Create .dockerignore
echo [3/7] Creating .dockerignore...
(
echo **/.git
echo **/.gitignore
echo **/.env
echo **/.env.backup
echo **/node_modules/
echo **/vendor/
echo **/storage/framework/cache/
echo **/storage/framework/sessions/
echo **/storage/framework/views/
echo **/storage/logs/
echo **/storage/app/public/media/
echo **/bootstrap/cache/
echo **/public/storage
echo **/public/hot
echo **/.phpunit.result.cache
echo **/.DS_Store
echo **/Thumbs.db
echo **/.vscode/
echo **/.idea/
) > .dockerignore
REM Verify .dockerignore
if not exist .dockerignore (
echo ERROR: Failed to create .dockerignore
pause
exit /b 1
)
REM Remove old Docker images
echo [4/7] Removing old Docker images...
docker rmi decimer-app-windows:latest 2>nul
REM Build
echo [5/7] Building Docker image...
echo This will take 5-10 minutes on first build...
docker-compose -f docker-compose.windows.yml build --no-cache
if %ERRORLEVEL% NEQ 0 (
echo.
echo ==========================================
echo ERROR: Build failed!
echo ==========================================
echo.
echo Troubleshooting:
echo 1. Check Docker Desktop is running
echo 2. Check internet connection
echo 3. Try: docker system prune -a
echo.
pause
exit /b 1
)
REM Start containers
echo [6/7] Starting containers...
docker-compose -f docker-compose.windows.yml up -d
REM Wait for initialization
echo [7/7] Waiting for initialization...
echo The entrypoint will generate APP_KEY automatically...
timeout /t 15 /nobreak >nul
REM Verify
echo.
echo ==========================================
echo Verifying Installation
echo ==========================================
echo.
echo Checking APP_KEY:
docker-compose -f docker-compose.windows.yml exec app cat .env | findstr APP_KEY
echo.
echo Container Status:
docker-compose -f docker-compose.windows.yml ps
echo.
echo ==========================================
echo SUCCESS! DECIMER is ready
echo ==========================================
echo.
echo Access: http://localhost:8080
echo.
echo Useful commands:
echo Start: docker-compose -f docker-compose.windows.yml up -d
echo Stop: docker-compose -f docker-compose.windows.yml down
echo Logs: docker-compose -f docker-compose.windows.yml logs -f
echo.
pause