From 8ae9599d0fa5fc36592018098811d0c3c6748818 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Thu, 27 Apr 2023 09:50:11 +0200 Subject: [PATCH] fix(build): make image load work --- src/build/run.cr | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/build/run.cr b/src/build/run.cr index cc83f95..0d1c5d0 100644 --- a/src/build/run.cr +++ b/src/build/run.cr @@ -55,23 +55,35 @@ module DocMachine::Build Process.run("docker", ["pull", @docker_image], output: STDOUT) Log.info { "Building cache for image (#{data_cache_dir})" } FileUtils.mkdir_p(data_cache_dir) - Process.run( + status = Process.run( "docker", ["image", "save", @docker_image, "-o", data_cache_file.to_s], output: STDOUT ) - Log.info { "done" } + if status.success? + Log.info { "done" } + else + Log.error { "Unable to save cache image" } + exit 1 + end + else Log.info { "Cache already exist. Skipping." } end Log.info { "Loading #{@docker_image} image from cache..." } docker_image_loaded = false - Process.run( + status = Process.run( "docker", - ["image", "load", @docker_image, "-i", data_cache_file.to_s], + ["image", "load", "-i", data_cache_file.to_s], output: STDOUT ) + if status.success? + Log.info { "done" } + else + Log.error { "Unable to load cache image" } + exit 1 + end end def start()