Skip to content

Commit

Permalink
Pass build description labels to podman build
Browse files Browse the repository at this point in the history
The Compose Specification supports adding labels to the build image
which is also used in practice. Support this and pass the labels to
`podman build`.

Signed-off-by: Sebastian Wick <sebastian.wick@redhat.com>
  • Loading branch information
swick committed Jul 7, 2024
1 parent 3296c8d commit b54b892
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2378,6 +2378,8 @@ async def build_one(compose, args, cnt):
build_args.extend(get_secret_args(compose, cnt, secret, podman_is_building=True))
for tag in build_desc.get("tags", []):
build_args.extend(["-t", tag])
for label in build_desc.get("labels", []):
build_args.extend(["--label", label])
for additional_ctx in build_desc.get("additional_contexts", {}):
build_args.extend([f"--build-context={additional_ctx}"])
if "target" in build_desc:
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,3 @@ ALT buildno=2 port 8000 2019-09-03T15:16:38+0000

as you can see we were able to override buildno to be 2 instead of 1,
and httpd_port to 8000.

NOTE: build labels are not passed to `podman build`

0 comments on commit b54b892

Please sign in to comment.