Mercurial > code > home > repos > homeauto
diff service/wifi/tasks.py @ 564:d0830394bf7b
update build on service/wifi
Ignore-this: 4d68aad5f218c2ec114155290c4a4bf8
author | drewp@bigasterisk.com |
---|---|
date | Fri, 03 May 2019 18:54:05 -0700 |
parents | service/wifi/makefile@ab8cd52552e7 |
children | 540dd68af9f2 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/service/wifi/tasks.py Fri May 03 18:54:05 2019 -0700 @@ -0,0 +1,25 @@ +from invoke import task + +JOB = 'wifi' +PORT = 9070 +TAG = f'bang6:5000/{JOB}_x86:latest' + +@task +def build_image(ctx): + ctx.run(f'docker build --network=host -t {TAG} .') + +@task(pre=[build_image]) +def push_image(ctx): + ctx.run(f'docker push {TAG}') + +@task(pre=[build_image]) +def shell(ctx): + ctx.run(f'docker run --name {JOB}_shell --rm -it --cap-add SYS_PTRACE --net=host {TAG} /bin/bash', pty=True) + +@task(pre=[build_image]) +def local_run(ctx): + ctx.run(f'docker run --name {JOB}_local --rm -it --net=host {TAG} python3 wifi.py -v', pty=True) + +@task(pre=[push_image]) +def redeploy(ctx): + ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')