Skip to content

Commit

Permalink
support Docker --output argument (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
coffee-cup authored Jul 31, 2024
1 parent 4e038ea commit c0c2e88
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ enum Commands {
#[arg(long)]
docker_tls_verify: Option<String>,

/// Specify output destination for Docker build.
/// https://docs.docker.com/reference/cli/docker/buildx/build/#output
#[arg(long)]
docker_output: Option<String>,

/// Enable writing cache metadata into the output image
#[arg(long)]
inline_cache: bool,
Expand Down Expand Up @@ -259,6 +264,7 @@ async fn main() -> Result<()> {
cache_from,
docker_host,
docker_tls_verify,
docker_output,
add_host,
inline_cache,
no_error_without_start,
Expand Down Expand Up @@ -290,6 +296,7 @@ async fn main() -> Result<()> {
cache_from,
docker_host,
docker_tls_verify,
docker_output,
no_error_without_start,
incremental_cache_image,
cpu_quota,
Expand Down
4 changes: 4 additions & 0 deletions src/nixpacks/builder/docker/docker_image_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,10 @@ impl DockerImageBuilder {
}
}

if let Some(value) = &self.options.docker_output {
docker_build_cmd.arg("--output").arg(value);
}

if self.options.inline_cache {
docker_build_cmd
.arg("--build-arg")
Expand Down
1 change: 1 addition & 0 deletions src/nixpacks/builder/docker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub struct DockerBuilderOptions {
pub verbose: bool,
pub docker_host: Option<String>,
pub docker_tls_verify: Option<String>,
pub docker_output: Option<String>,
pub add_host: Vec<String>,
}

Expand Down

0 comments on commit c0c2e88

Please sign in to comment.