view tasks.py @ 3:acb378b62dfd

--now feature for testing Ignore-this: 6bdde93e896c4f4b8bbe7df4e2d3f42e
author drewp@bigasterisk.com
date Thu, 16 Jan 2020 23:34:11 -0800
parents e40034f22c69
children 1e281ead081a
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 --now', pty=True)

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