-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAnadoluAjansi.bat
95 lines (76 loc) · 2.81 KB
/
AnadoluAjansi.bat
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
@echo off
REM Set script directory path
set SCRIPT_DIR=%~dp0
REM Create repositories and cache directories if they do not exist
if not exist "%SCRIPT_DIR%repositories\" mkdir "%SCRIPT_DIR%repositories"
if not exist "%SCRIPT_DIR%cache\pip\" mkdir "%SCRIPT_DIR%cache\pip"
REM Convert script directory to a relative path for Docker (if necessary)
REM Example: set RELATIVE_PATH=..\..\DockerVolumes
REM Check for network connectivity
ping -n 1 www.google.com >nul 2>&1
if errorlevel 1 (
echo You must be connected to the internet to run this script.
exit /b
)
REM Check for Docker installation and start Docker
where docker >nul 2>&1
if errorlevel 1 (
echo Docker is not installed. Please install Docker and run this script again.
exit /b
) else (
echo Starting Docker...
start "" "docker"
REM Add logic to wait for Docker to be ready
)
REM Check for Git installation
where git >nul 2>&1
if errorlevel 1 (
echo Git is not installed. Please install Git and run this script again.
exit /b
)
REM Check for Python installation
where python >nul 2>&1
if errorlevel 1 (
echo Python is not installed. Please install Python and run this script again.
exit /b
)
REM Start Docker Desktop (if not already started)
echo Starting Docker Desktop...
start "" "C:\Program Files\Docker\Docker\Docker Desktop.exe"
REM Wait for Docker Desktop to be ready
echo Waiting for Docker Desktop to be ready...
:WaitForDocker
timeout /t 1 >nul
docker info >nul 2>&1
if errorlevel 1 goto WaitForDocker
echo Docker Desktop is ready.
REM Set the code page to UTF-8 for handling Turkish characters
echo Setting code page to UTF-8...
chcp 65001
REM Run the Docker container with relative paths
echo Running the Docker container...
docker run -d --gpus=all -e NVIDIA_DRIVER_CAPABILITIES=compute,utility -e NVIDIA_VISIBLE_DEVICES=all -v "%SCRIPT_DIR%repositories:/app/repositories" -v "%SCRIPT_DIR%cache\pip:/root/.cache/pip" -p 8888:8888 konieshadow/fooocus-api
REM Check if the repo exists
echo Checking for existing Git repository...
if not exist "%SCRIPT_DIR%Anadolu-Ajans--Medya-Teknolojileri-hackathon\.git" (
echo Cloning the repository...
git clone https://github.com/sezer-muhammed/Anadolu-Ajans--Medya-Teknolojileri-hackathon.git
) else (
echo Repository found. Pulling latest changes...
cd Anadolu-Ajans--Medya-Teknolojileri-hackathon
git pull
cd ..
)
REM Navigate to the project directory and run the server
echo Navigating to the project directory...
cd Anadolu-Ajans--Medya-Teknolojileri-hackathon
echo Installing and updating Requirements
pip install -r requirements.txt
cd AnadoluAjansiMedyaTeknolojileriWebApp
echo Starting Django server...
start python manage.py runserver
REM Wait a bit for the server to start
timeout /t 10
REM Open the web page
echo Opening web page...
start http://127.0.0.1:8000//GUI/upload