develop #3
1 changed files with 16 additions and 4 deletions
|
@ -55,23 +55,35 @@ module DocMachine::Build
|
||||||
Process.run("docker", ["pull", @docker_image], output: STDOUT)
|
Process.run("docker", ["pull", @docker_image], output: STDOUT)
|
||||||
Log.info { "Building cache for image (#{data_cache_dir})" }
|
Log.info { "Building cache for image (#{data_cache_dir})" }
|
||||||
FileUtils.mkdir_p(data_cache_dir)
|
FileUtils.mkdir_p(data_cache_dir)
|
||||||
Process.run(
|
status = Process.run(
|
||||||
"docker",
|
"docker",
|
||||||
["image", "save", @docker_image, "-o", data_cache_file.to_s],
|
["image", "save", @docker_image, "-o", data_cache_file.to_s],
|
||||||
output: STDOUT
|
output: STDOUT
|
||||||
)
|
)
|
||||||
Log.info { "done" }
|
if status.success?
|
||||||
|
Log.info { "done" }
|
||||||
|
else
|
||||||
|
Log.error { "Unable to save cache image" }
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
Log.info { "Cache already exist. Skipping." }
|
Log.info { "Cache already exist. Skipping." }
|
||||||
end
|
end
|
||||||
|
|
||||||
Log.info { "Loading #{@docker_image} image from cache..." }
|
Log.info { "Loading #{@docker_image} image from cache..." }
|
||||||
docker_image_loaded = false
|
docker_image_loaded = false
|
||||||
Process.run(
|
status = Process.run(
|
||||||
"docker",
|
"docker",
|
||||||
["image", "load", @docker_image, "-i", data_cache_file.to_s],
|
["image", "load", "-i", data_cache_file.to_s],
|
||||||
output: STDOUT
|
output: STDOUT
|
||||||
)
|
)
|
||||||
|
if status.success?
|
||||||
|
Log.info { "done" }
|
||||||
|
else
|
||||||
|
Log.error { "Unable to load cache image" }
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def start()
|
def start()
|
||||||
|
|
Loading…
Reference in a new issue