import invoke import pathlib PATH = pathlib.Path(__file__).parent @invoke.task() def start(ctx): with ctx.cd(PATH): ctx.run("docker-compose up -d") @invoke.task() def stop(ctx): with ctx.cd(PATH): ctx.run("docker-compose down") @invoke.task() def restart(ctx): with ctx.cd(PATH): ctx.run("docker-compose restart") ns = invoke.Collection("kong") ns.add_task(start) ns.add_task(restart) ns.add_task(stop)