add build subcommand and --build arg to compose_run

Signed-off-by: Sergei Biriukov <svbiriukov@gmail.com>
This commit is contained in:
Sergei Biriukov 2023-04-21 20:15:23 +10:00 committed by Muayyad Alsadi
parent 5d279c4948
commit 6b6330c587

View File

@ -2382,6 +2382,15 @@ def compose_run(compose, args):
)
)
compose.commands["up"](compose, up_args)
build_args = argparse.Namespace(
services=[args.service],
if_not_exists=(not args.build),
build_arg=[],
**args.__dict__
)
compose.commands["build"](compose, build_args)
# adjust one-off container options
name0 = "{}_{}_tmp{}".format(
compose.project_name, args.service, random.randrange(0, 65536)
@ -2751,6 +2760,9 @@ def compose_down_parse(parser):
@cmd_parse(podman_compose, "run")
def compose_run_parse(parser):
parser.add_argument(
"--build", action="store_true", help="Build images before starting containers."
)
parser.add_argument(
"-d",
"--detach",