-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
37 lines (23 loc) · 827 Bytes
/
fabfile.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
from fabric.api import local
def build():
local('docker-compose build dddesign')
def _run_command_container(command):
container_id = local("docker ps | grep 'dddesign' | awk '{{ print $1 }}' | head -n 1", capture=True)
if container_id:
local(f'docker exec -it {container_id} bash -c "{command}"')
else:
local(f'docker-compose run --rm dddesign bash -c "{command}"')
def linters():
_run_command_container(
"ruff . --config ruff.toml --fix && echo 'Ruff check completed'; "
'ruff format . --config ruff.toml; '
'mypy --config mypy.toml;'
)
def tests():
_run_command_container('pytest')
def shell():
_run_command_container('python -m IPython')
def bash():
_run_command_container('bash')
def kill():
local('docker kill $(docker ps -q)')