comparison service/xidle/tasks.py @ 1491:6cd9341f0a28

xidle rewrite for docker, py3 Ignore-this: a866446f3f42069092dc40b48f12d46b darcs-hash:67026da0e635b31e2cec59037397b99b0ce7c4ac
author drewp <drewp@bigasterisk.com>
date Wed, 29 Jan 2020 01:02:06 -0800
parents
children
comparison
equal deleted inserted replaced
1490:455b1b80516e 1491:6cd9341f0a28
1 from invoke import task
2 JOB = 'xidle'
3 PORT = 9107
4 TAG_x86 = f'bang6:5000/{JOB.lower()}_x86:latest'
5 TAG_pi = f'bang6:5000/{JOB.lower()}_pi:latest'
6 ANSIBLE_TAG = 'homeauto_xidle'
7
8 @task
9 def build_image_x86(ctx):
10 ctx.run(f'docker build --network=host -t {TAG_x86} .')
11 @task
12 def build_image_pi(ctx):
13 ctx.run(f'docker build --file Dockerfile.pi --network=host -t {TAG_pi} .')
14
15 @task(pre=[build_image_x86])
16 def push_image_x86(ctx):
17 ctx.run(f'docker push {TAG_x86}')
18 @task(pre=[build_image_pi])
19 def push_image_pi(ctx):
20 ctx.run(f'docker push {TAG_pi}')
21
22 @task(pre=[build_image_x86])
23 def shell(ctx):
24 ctx.run(f'docker run --rm -it --cap-add SYS_PTRACE -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /home/drewp/.Xauthority:/root/.Xauthority --net=host {TAG_x86} /bin/bash', pty=True)
25
26 @task(pre=[build_image_x86])
27 def local_run(ctx):
28 ctx.run(f'docker run --rm -it -v /tmp/.X11-unix/:/tmp/.X11-unix/ -v /home/drewp/.Xauthority:/root/.Xauthority -p {PORT}:{PORT} -v /etc/resolv.conf:/etc/resolv.conf --net=host {TAG_x86} python3 xidle.py -v', pty=True)
29
30 @task(pre=[push_image_x86, push_image_pi])
31 def redeploy(ctx):
32 ctx.run(f'sudo /my/proj/ansible/playbook -t {ANSIBLE_TAG}')
33 #ctx.run(f'supervisorctl -s http://bang:9001/ restart {JOB}_{PORT}')