Module bake

Module bake 

Source
Expand description

Docker Bake Command Implementation

This module provides a comprehensive implementation of the docker bake command, supporting all native Docker buildx bake options for building from configuration files.

§Examples

§Basic Usage

use docker_wrapper::BakeCommand;
use docker_wrapper::DockerCommand;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Basic bake with default docker-bake.hcl file
    let bake_cmd = BakeCommand::new();
    let output = bake_cmd.execute().await?;
    println!("Bake completed: {}", output.success);
    Ok(())
}

§Advanced Usage

use docker_wrapper::BakeCommand;
use docker_wrapper::DockerCommand;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Advanced bake with custom file and targets
    let bake_cmd = BakeCommand::new()
        .file("docker-compose.yml")
        .file("custom-bake.hcl")
        .target("web")
        .target("api")
        .push()
        .no_cache()
        .set("web.platform", "linux/amd64,linux/arm64")
        .metadata_file("build-metadata.json");

    let output = bake_cmd.execute().await?;
    println!("Multi-target bake completed: {}", output.success);
    Ok(())
}

Structs§

BakeCommand
Docker Bake Command Builder