File size: 2,114 Bytes
01d5a5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
@echo off
REM Script to prompt user for CUDA support preference

echo === CUDA Support Selection ===
echo.
echo Do you want to build with NVIDIA GPU (CUDA) support?
echo This requires an NVIDIA GPU and proper NVIDIA Docker runtime configuration.
echo.
set /p choice="Build with CUDA support? (y/n): "

if /i "%choice%"=="y" goto cuda
if /i "%choice%"=="yes" goto cuda
goto nocuda

:cuda
echo Selected: Build WITH CUDA support

REM Create or update .env file with the Dockerfile selection
if exist .env (
    REM Check if variable already exists in file
    findstr /c:"DOCKER_BACKEND_DOCKERFILE" .env >nul
    if %ERRORLEVEL% EQU 0 (
        REM Update existing variable
        powershell -Command "(Get-Content .env) -replace '^DOCKER_BACKEND_DOCKERFILE=.*', 'DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda' | Set-Content .env"
    ) else (
        REM Append to file with newline before
        echo.>> .env
        echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda>> .env
    )
) else (
    REM Create new file
    echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend.cuda> .env
)

REM Create a flag file to indicate GPU use
echo GPU > .gpu_selected

echo Environment set to build with CUDA support
goto end

:nocuda
echo Selected: Build WITHOUT CUDA support (CPU only)

REM Create or update .env file with the Dockerfile selection
if exist .env (
    REM Check if variable already exists in file
    findstr /c:"DOCKER_BACKEND_DOCKERFILE" .env >nul
    if %ERRORLEVEL% EQU 0 (
        REM Update existing variable
        powershell -Command "(Get-Content .env) -replace '^DOCKER_BACKEND_DOCKERFILE=.*', 'DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend' | Set-Content .env"
    ) else (
        REM Append to file with newline before
        echo.>> .env
        echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend>> .env
    )
) else (
    REM Create new file
    echo DOCKER_BACKEND_DOCKERFILE=Dockerfile.backend> .env
)

REM Remove any GPU flag file if it exists
if exist .gpu_selected (
    del .gpu_selected
)

echo Environment set to build without CUDA support

:end
echo === CUDA Selection Complete ===