-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.py
28 lines (24 loc) · 915 Bytes
/
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
import subprocess
commands = [
"sudo docker image build -t python-3-9-dlib-facerecognition -f \"Dockerfile-dlib\" .",
"sudo docker image build -t service44_profiles-app .",
"sudo docker image build -t service44_video-processing .",
"sudo docker compose run --rm profiles-app sh -c \"cd /app/src/migrations && PYTHONPATH=/app/src python update.py\"",
"sudo docker compose up --detach --force-recreate"
]
directories = [
".",
"profiles-app",
"video-processing",
".",
"."
]
try:
for command, directory in zip(commands, directories):
print(f"Выполняю команду: {command}\n")
subprocess.run(command, shell=True, check=True, cwd=directory)
print()
except subprocess.CalledProcessError as e:
print(f"Команда {e.cmd} завершилась с ошибкой: {e.returncode}")
exit(1)
print("Скрипт завершен")