-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_deploy.py
executable file
·41 lines (35 loc) · 1.21 KB
/
build_deploy.py
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
#!/usr/bin/env python3
import shutil
import cleanterminus
import subprocess
import os
import sys
from pathlib import Path
cleanterminus.clear()
os.chdir("client")
print("Building client...")
commandLine = "tools/build.py"
if "-quick" in sys.argv:
commandLine = "tools/build.py -quick"
subprocess.run(commandLine, shell=True, check=True)
os.chdir("..")
os.chdir("server")
print("Building server...")
subprocess.run('tools/build.py', shell=True, check=True)
os.chdir("..")
cleanterminus.clear()
print("Deploying...")
docker_image_flag_file = Path('/DockerImage')
if docker_image_flag_file.exists():
print("Official Docker image, deploying...")
shutil.copytree('client', '/var/www/html/Masonry-AR/client', dirs_exist_ok=True)
shutil.copytree('server/src', '/var/www/html/Masonry-AR/server/', dirs_exist_ok=True)
else:
print("Not official docker image, deploying...")
try:
shutil.rmtree('/srv/http/Masonry-AR')
except:
pass
shutil.copytree('client', '/srv/http/Masonry-AR/client/0', dirs_exist_ok=True)
shutil.copyfile('client/tools/cacheBuster/index.php', '/srv/http/Masonry-AR/client/index.php')
shutil.copytree('server/src', '/srv/http/Masonry-AR/server/', dirs_exist_ok=True)