diff service/environment/tasks.py @ 1523:0da337780f22

dep updates; graph url renames; and other build updates Ignore-this: 4603ef3d8db650a13e543dad8580ade8 darcs-hash:0840491cd6a4e4966f47a2abca0ed30ec434022a
author drewp <drewp@bigasterisk.com>
date Wed, 05 Feb 2020 00:23:06 -0800
parents
children 4857e22137c0
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/service/environment/tasks.py	Wed Feb 05 00:23:06 2020 -0800
@@ -0,0 +1,28 @@
+from invoke import task
+
+JOB='environment'
+PORT=9075
+
+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  -v `pwd`:/opt/homeauto_store --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG}  /bin/bash', pty=True)
+
+@task(pre=[build_image])
+def local_run(ctx):
+    ctx.run(f'docker run --rm -it -p {PORT}:{PORT}  -v `pwd`:/opt/homeauto_store --dns 10.2.0.1 --dns-search bigasterisk.com --net=host {TAG} python3 {JOB}.py -v', pty=True)
+
+@task(pre=[push_image])
+def redeploy(ctx):
+    ctx.run(f'supervisorctl -s http://bang:9001/ restart envgraph_{PORT}')