From 901adf47d0a0a00a12bdeb3b9d92c74a90ff98aa Mon Sep 17 00:00:00 2001 From: Hedayat Vatankhah Date: Sun, 16 Jul 2023 03:07:33 +0330 Subject: [PATCH] Use defined environment variables in the image build process Build images with service environment variables defined so that they can be used in the build process Signed-off-by: Hedayat Vatankhah --- podman_compose.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/podman_compose.py b/podman_compose.py index 4fdf7b98..9dcc8e98 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2100,6 +2100,10 @@ def build_one(compose, args, cnt): build_args.append("--pull-always") elif getattr(args, "pull", None): build_args.append("--pull") + env = dict(cnt.get("environment", {})) + for name, value in env.items(): + build_args += ["--env", f"{name}" if value is None else f"{name}={value}"] + args_list = norm_as_list(build_desc.get("args", {})) for build_arg in args_list + args.build_arg: build_args.extend(