From cf345ee0d7813cdfb111f68fed65b4e43b1ea169 Mon Sep 17 00:00:00 2001 From: Shivam Mehta Date: Tue, 9 Dec 2025 09:44:05 -0700 Subject: [PATCH] Copy files earlier in image building process Signed-off-by: Shivam Mehta --- src/layer.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/layer.py b/src/layer.py index df02c14..8c1abde 100644 --- a/src/layer.py +++ b/src/layer.py @@ -42,6 +42,18 @@ def buildah_handler(line): cmd(["buildah", "from"] + registry_opts_pull + ["--name", container + dt_string, parent], stdout_handler = buildah_handler) cname = out[0] + # Copy Files + try: + inst.install_copyfiles(copyfiles) + except Exception as e: + self.logger.error(f"Error running commands: {e}") + cmd(["buildah","rm"] + [cname]) + sys.exit("Exiting now") + except KeyboardInterrupt: + self.logger.error(f"Keyboard Interrupt") + cmd(["buildah","rm"] + [cname]) + sys.exit("Exiting now ...") + # Only mount when doing a scratch install if parent == "scratch": out = [] @@ -139,18 +151,6 @@ def buildah_handler(line): cmd(["buildah","rm"] + [cname]) sys.exit("Exiting now ...") - # Copy Files - try: - inst.install_copyfiles(copyfiles) - except Exception as e: - self.logger.error(f"Error running commands: {e}") - cmd(["buildah","rm"] + [cname]) - sys.exit("Exiting now") - except KeyboardInterrupt: - self.logger.error(f"Keyboard Interrupt") - cmd(["buildah","rm"] + [cname]) - sys.exit("Exiting now ...") - # Run Commands try: inst.install_commands(commands)