From c7aa9c584b9f0227de504073826befc8c3dae9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=C3=A9fix=20Estrada?= Date: Thu, 10 Aug 2023 18:22:27 +0200 Subject: [PATCH] feat(build): add support for 'cache_from' and 'cache_to' instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Néfix Estrada --- podman_compose.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/podman_compose.py b/podman_compose.py index 20011455..86e39a7a 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -2128,6 +2128,14 @@ def build_one(compose, args, cnt): build_args.extend(["-t", tag]) if "target" in build_desc: build_args.extend(["--target", build_desc["target"]]) + cache_from = build_desc.get("cache_from", []) + cache_to = build_desc.get("cache_to", []) + if cache_from or cache_to: + build_args.extend(["--layers"]) + for cache in cache_from: + build_args.extend(["--cache-from", cache]) + for cache in cache_to: + build_args.extend(["--cache-to", cache]) container_to_ulimit_args(cnt, build_args) if getattr(args, "no_cache", None): build_args.append("--no-cache")