Print docker build

This commit is contained in:
Luke Parker 2023-07-25 22:18:20 -04:00
parent 1af5f1bcdc
commit 42eb674d1a
No known key found for this signature in database

View file

@ -117,6 +117,23 @@ pub fn build(name: String) {
println!("Building {}...", &name); println!("Building {}...", &name);
// Version which always prints
if !Command::new("docker")
.current_dir(deploy_path)
.arg("compose")
.arg("build")
.arg(&name)
.spawn()
.unwrap()
.wait()
.unwrap()
.success()
{
panic!("failed to build {name}");
}
// Version which only prints on error
/*
let res = Command::new("docker") let res = Command::new("docker")
.current_dir(deploy_path) .current_dir(deploy_path)
.arg("compose") .arg("compose")
@ -140,19 +157,22 @@ pub fn build(name: String) {
); );
panic!("failed to build {name}"); panic!("failed to build {name}");
} }
*/
println!("Built!"); println!("Built!");
if std::env::var("GITHUB_CI").is_ok() { if std::env::var("GITHUB_CI").is_ok() {
println!("In CI, so clearing cache to prevent hitting the storage limits."); println!("In CI, so clearing cache to prevent hitting the storage limits.");
Command::new("docker") if !Command::new("docker")
.arg("builder") .arg("builder")
.arg("prune") .arg("prune")
.arg("--all") .arg("--all")
.arg("--force") .arg("--force")
.output() .output()
.unwrap(); .unwrap()
if !res.status.success() { .status
.success()
{
println!("failed to clear cache after building {name}\n"); println!("failed to clear cache after building {name}\n");
} }
} }