view service/reasoning/tasks.py @ 1384:a29a55f3429c

mqtt_graph_bridge to new build rules and to py3 Ignore-this: 1a064e89a2016ed583c1d4c9bbfd6f7c darcs-hash:b40c5fcff313002f6468e7a94a2059f1dd5dd97c
author drewp <drewp@bigasterisk.com>
date Thu, 09 May 2019 22:31:04 -0700
parents ac127fdace62
children 6c86c6a87eab
line wrap: on
line source

from invoke import task

JOB='reasoning'
PORT=9071

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
def shell(ctx):
    ctx.run(f'docker run --rm -it --cap-add SYS_PTRACE --net=host {TAG}  /bin/bash')

@task(pre=[build_image])
def local_run(ctx):
    ctx.run(f'docker run --rm -it -p {PORT}:{PORT} -v `pwd`:/mnt --net=host {TAG} python /mnt/{JOB}.py -iro', pty=True)

@task(pre=[build_image])
def redeploy(ctx): 
    ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')