diff pi-watchdog/tasks.py @ 332:d4893670f888 default tip

WIP: use watchdog reboot timer on pi
author drewp@bigasterisk.com
date Thu, 27 Feb 2025 11:09:29 -0800
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pi-watchdog/tasks.py	Thu Feb 27 11:09:29 2025 -0800
@@ -0,0 +1,24 @@
+import datetime
+
+from invoke import task
+
+# todo- see https://github.com/GoogleContainerTools/skaffold/issues/9543 for one obstacle
+
+now = datetime.datetime.now().replace(microsecond=0)
+now = now.isoformat().replace(':', '_').replace('-', '_')
+base = 'pi_watchdog'
+localImage = f'{base}:{now}'
+remoteImage = f'reg:5000/{base}:latest'
+
+
+@task
+def build(ctx):  # workaround for skaffold build
+    ctx.run(f'podman manifest create {localImage}', echo=True)
+    ctx.run(f'podman build --platform linux/arm64 --manifest {localImage} -f Dockerfile .', echo=True)
+    ctx.run(f'podman manifest push {localImage} {remoteImage}', echo=True)
+    print(f'{remoteImage} ready for use')
+
+
+@task(pre=[build])
+def run(ctx):
+    ctx.run('kubectl apply -f deploy.yaml', echo=True)