view service/reasoning/tasks.py @ 1374:ac127fdace62

build/import update for reasoning service Ignore-this: 5e2a8d717e7273bf4a84dd467cccab17 darcs-hash:dc2e5f5c0ee7beb2d72f2c585d88480c5a1312df
author drewp <drewp@bigasterisk.com>
date Mon, 06 May 2019 00:05:24 -0700
parents
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}')