view service/wifi/tasks.py @ 1473:4bbc68603168

npm run build works now, accessing streamed-graph. But, s-g isn't in the output bundle yet. Ignore-this: 2b08220ad8d275f4dd242c3aa1a8647a darcs-hash:713c0960d19658e35685d64dc855ca63e1fde660
author drewp <drewp@bigasterisk.com>
date Sun, 29 Dec 2019 19:41:48 -0800
parents 32d134dbfb1e
children e188fd8351c0
line wrap: on
line source

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 -v `pwd`:/opt {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}')


# one time:
#   yarn policies set-version v2
# and for vscode:
#   yarn pnpify --sdk
#   then pick the pnp one on statusbar.

#yarn run webpack-cli --config webpack.config.js --mode production


@task
def build(ctx):
    ctx.run(f'npm run webpack-build', pty=True)
    
@task
def serve_demo(ctx):
    ctx.run('npm run webpack-dev-server')