332
|
1 import datetime
|
|
2
|
|
3 from invoke import task
|
|
4
|
|
5 # todo- see https://github.com/GoogleContainerTools/skaffold/issues/9543 for one obstacle
|
|
6
|
|
7 now = datetime.datetime.now().replace(microsecond=0)
|
|
8 now = now.isoformat().replace(':', '_').replace('-', '_')
|
|
9 base = 'pi_watchdog'
|
|
10 localImage = f'{base}:{now}'
|
|
11 remoteImage = f'reg:5000/{base}:latest'
|
|
12
|
|
13
|
|
14 @task
|
|
15 def build(ctx): # workaround for skaffold build
|
|
16 ctx.run(f'podman manifest create {localImage}', echo=True)
|
|
17 ctx.run(f'podman build --platform linux/arm64 --manifest {localImage} -f Dockerfile .', echo=True)
|
|
18 ctx.run(f'podman manifest push {localImage} {remoteImage}', echo=True)
|
|
19 print(f'{remoteImage} ready for use')
|
|
20
|
|
21
|
|
22 @task(pre=[build])
|
|
23 def run(ctx):
|
|
24 ctx.run('kubectl apply -f deploy.yaml', echo=True)
|