Mercurial > code > home > repos > homeauto
view service/piNode/tasks.py @ 1444:4afb1830bb5e
use rx version 3.x
Ignore-this: 4232f8e780d35a8d0642e86521eb2801
darcs-hash:747608892b607f78260f4772a4ff2b24c7392f73
author | drewp <drewp@bigasterisk.com> |
---|---|
date | Tue, 24 Sep 2019 14:04:02 -0700 |
parents | af2d0249a2cc |
children | 0da337780f22 |
line wrap: on
line source
from invoke import task JOB = 'piNode' PORT = 9059 TAG = f'bang6:5000/{JOB.lower()}_pi:latest' ANSIBLE_TAG = 'raspi_io_node' @task def build_image(ctx): ctx.run(f'docker build --network=host -t {TAG} .') @task def build_image_check(ctx): ctx.run(f'docker build --network=host -f Dockerfile.check -t bang6:5000/pinode_check:latest .') @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 --uts=host --cap-add SYS_RAWIO --device /dev/mem --privileged {TAG} /bin/bash', pty=True) @task(pre=[build_image_check]) def check(ctx): ctx.run(f'docker run --name={JOB}_check --rm -it -v `pwd`:/opt --net=host bang6:5000/pinode_check:latest pytype -d import-error mypkg/piNode.py', pty=True) @task(pre=[build_image_check]) def check_shell(ctx): ctx.run(f'docker run --name={JOB}_check --rm -it -v `pwd`:/opt --net=host bang6:5000/pinode_check:latest /bin/bash', pty=True) @task(pre=[build_image]) def local_run(ctx): ctx.run(f'docker run --name={JOB}_local --rm -it {TAG} python ./piNode.py -v', pty=True) @task(pre=[push_image]) def redeploy(ctx): ctx.run(f'sudo /my/proj/ansible/playbook -l pi -t {ANSIBLE_TAG}') @task def push_config(ctx): ctx.run(f'docker run --rm --net=host -v `pwd`/config:/opt/config bang6:5000/arduino_node python pushConfig.py pi/')