view tasks.py @ 0:e40034f22c69

moved from pimscreen, upgrade to py3. Redo google auth. Ignore-this: 43ada92a0639d288ca76e5486f6fa489
author drewp@bigasterisk.com
date Tue, 25 Jun 2019 17:08:27 -0700
parents
children acb378b62dfd
line wrap: on
line source

from invoke import task

JOB = 'gcalendarwatch'
PORT = 9105
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 gcalendarwatch -v', pty=True)

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