fix: Don't create builder if DOCKER_HOST is set
This commit is contained in:
parent
a2ca8c6fc9
commit
73f219d4ca
2 changed files with 17 additions and 4 deletions
|
|
@ -5,7 +5,9 @@ use std::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use anyhow::{anyhow, bail, Result};
|
use anyhow::{anyhow, bail, Result};
|
||||||
use blue_build_utils::constants::{BB_BUILDKIT_CACHE_GHA, CONTAINER_FILE, SKOPEO_IMAGE};
|
use blue_build_utils::constants::{
|
||||||
|
BB_BUILDKIT_CACHE_GHA, CONTAINER_FILE, DOCKER_HOST, SKOPEO_IMAGE,
|
||||||
|
};
|
||||||
use log::{info, trace, warn};
|
use log::{info, trace, warn};
|
||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use semver::Version;
|
use semver::Version;
|
||||||
|
|
@ -196,13 +198,21 @@ impl BuildDriver for DockerDriver {
|
||||||
warn!("Squash is deprecated for docker so this build will not squash");
|
warn!("Squash is deprecated for docker so this build will not squash");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trace!("docker buildx");
|
||||||
let mut command = Command::new("docker");
|
let mut command = Command::new("docker");
|
||||||
|
command.arg("buildx");
|
||||||
|
|
||||||
trace!("docker buildx build -f {CONTAINER_FILE}");
|
if !env::var(DOCKER_HOST).is_ok_and(|dh| !dh.is_empty()) {
|
||||||
|
Self::setup()?;
|
||||||
|
|
||||||
|
trace!("--builder=bluebuild");
|
||||||
|
command.arg("--builder=bluebuild");
|
||||||
|
}
|
||||||
|
|
||||||
|
trace!("build --progress=plain --pull -f {CONTAINER_FILE}",);
|
||||||
command
|
command
|
||||||
.arg("buildx")
|
|
||||||
.arg("--builder=bluebuild")
|
|
||||||
.arg("build")
|
.arg("build")
|
||||||
|
.arg("--progress=plain")
|
||||||
.arg("--pull")
|
.arg("--pull")
|
||||||
.arg("-f")
|
.arg("-f")
|
||||||
.arg(CONTAINER_FILE);
|
.arg(CONTAINER_FILE);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,9 @@ pub const IMAGE_VERSION_LABEL: &str = "org.opencontainers.image.version";
|
||||||
// BlueBuild vars
|
// BlueBuild vars
|
||||||
pub const BB_BUILDKIT_CACHE_GHA: &str = "BB_BUILDKIT_CACHE_GHA";
|
pub const BB_BUILDKIT_CACHE_GHA: &str = "BB_BUILDKIT_CACHE_GHA";
|
||||||
|
|
||||||
|
// Docker vars
|
||||||
|
pub const DOCKER_HOST: &str = "DOCKER_HOST";
|
||||||
|
|
||||||
// Cosign vars
|
// Cosign vars
|
||||||
pub const COSIGN_PRIVATE_KEY: &str = "COSIGN_PRIVATE_KEY";
|
pub const COSIGN_PRIVATE_KEY: &str = "COSIGN_PRIVATE_KEY";
|
||||||
pub const GITHUB_TOKEN_ISSUER_URL: &str = "https://token.actions.githubusercontent.com";
|
pub const GITHUB_TOKEN_ISSUER_URL: &str = "https://token.actions.githubusercontent.com";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue