forked from tilt-dev/tilt-extensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tiltfile
40 lines (36 loc) · 1.44 KB
/
Tiltfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- mode: Python -*-
def podman_build(
ref, context, ignore=None, extra_flags=None, deps=None, live_update=[]
):
"""Use Podman (https://podman.io/) to build images for Tilt.
Args:
ref: The name of the image to build. Must match the image
name in the Kubernetes resources you're deploying.
context: The build context of the binary to build. Expressed as a file path.
deps: Changes to the given files or directories that will trigger rebuilds.
Defaults to the build context.
ignore: Changes to the given files or directories do not trigger rebuilds.
Does not affect the build context.
extra_flags: Extra flags to pass to podman build. Expressed as an argv-style array.
live_update: Set of steps for updating a running container
(see https://docs.tilt.dev/live_update_reference.html)
"""
deps = deps or [context]
extra_flags = extra_flags or []
extra_flags_str = ' '.join([shlex.quote(f) for f in extra_flags])
# We use --format=docker due to
# https://github.com/containers/buildah/issues/1589
# which lots of people are still reporting, even though it's closed :shrug:
push_cmd = "podman push --format=docker $EXPECTED_REF\n"
custom_build(
ref=ref,
command=(
"set -ex\n" +
"podman build -t $EXPECTED_REF %s %s\n" +
push_cmd
) % (extra_flags_str, shlex.quote(context)),
ignore=ignore,
deps=deps,
live_update=live_update,
skips_local_docker=True,
)