added test for everything container related
This commit is contained in:
@@ -52,3 +52,33 @@ pub fn remove(container: &str) -> Result<CommandResult, BuildahError> {
|
||||
pub fn list() -> Result<CommandResult, BuildahError> {
|
||||
execute_buildah_command(&["containers"])
|
||||
}
|
||||
|
||||
/// Build an image from a Containerfile/Dockerfile
|
||||
///
|
||||
/// # Arguments
|
||||
///
|
||||
/// * `tag` - Optional tag for the image (e.g., "my-app:latest")
|
||||
/// * `context_dir` - The directory containing the Containerfile/Dockerfile (usually ".")
|
||||
/// * `file` - Optional path to a specific Containerfile/Dockerfile
|
||||
/// * `isolation` - Optional isolation method (e.g., "chroot", "rootless", "oci")
|
||||
pub fn build(tag: Option<&str>, context_dir: &str, file: &str, isolation: Option<&str>) -> Result<CommandResult, BuildahError> {
|
||||
let mut args = Vec::new();
|
||||
args.push("build");
|
||||
|
||||
if let Some(tag_value) = tag {
|
||||
args.push("-t");
|
||||
args.push(tag_value);
|
||||
}
|
||||
|
||||
if let Some(isolation_value) = isolation {
|
||||
args.push("--isolation");
|
||||
args.push(isolation_value);
|
||||
}
|
||||
|
||||
args.push("-f");
|
||||
args.push(file);
|
||||
|
||||
args.push(context_dir);
|
||||
|
||||
execute_buildah_command(&args)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user