@@ -12,7 +12,7 @@ use async_trait::async_trait;
1212/// This is essentially the same as `docker build` but accessed through
1313/// the builder subcommand interface.
1414///
15- /// # Example
15+ /// # Examples
1616///
1717/// ```no_run
1818/// use docker_wrapper::command::builder::BuilderBuildCommand;
@@ -33,64 +33,65 @@ use async_trait::async_trait;
3333/// ```
3434#[ derive( Debug , Clone ) ]
3535pub struct BuilderBuildCommand {
36- /// Underlying build command
36+ /// Underlying build command.
3737 inner : BuildCommand ,
3838}
3939
4040impl BuilderBuildCommand {
41- /// Create a new builder build command
41+ /// Creates a new builder build command.
4242 ///
4343 /// # Arguments
44- /// * `context` - Build context path (e.g., ".", "/path/to/dir")
44+ ///
45+ /// * `context` - Build context path (e.g., `.`, `/path/to/dir`).
4546 pub fn new ( context : impl Into < String > ) -> Self {
4647 Self {
4748 inner : BuildCommand :: new ( context) ,
4849 }
4950 }
5051
51- /// Set the Dockerfile to use
52+ /// Sets the Dockerfile to use.
5253 #[ must_use]
5354 pub fn dockerfile ( mut self , path : impl Into < String > ) -> Self {
5455 self . inner = self . inner . file ( path. into ( ) ) ;
5556 self
5657 }
5758
58- /// Tag the image
59+ /// Tags the image.
5960 #[ must_use]
6061 pub fn tag ( mut self , tag : impl Into < String > ) -> Self {
6162 self . inner = self . inner . tag ( tag) ;
6263 self
6364 }
6465
65- /// Do not use cache when building
66+ /// Do not use cache when building.
6667 #[ must_use]
6768 pub fn no_cache ( mut self ) -> Self {
6869 self . inner = self . inner . no_cache ( ) ;
6970 self
7071 }
7172
72- /// Set build-time variables
73+ /// Sets build-time variables.
7374 #[ must_use]
7475 pub fn build_arg ( mut self , key : impl Into < String > , value : impl Into < String > ) -> Self {
7576 self . inner = self . inner . build_arg ( key, value) ;
7677 self
7778 }
7879
79- /// Set target build stage
80+ /// Sets target build stage.
8081 #[ must_use]
8182 pub fn target ( mut self , target : impl Into < String > ) -> Self {
8283 self . inner = self . inner . target ( target) ;
8384 self
8485 }
8586
86- /// Set platform for multi-platform builds
87+ /// Sets platform for multi-platform builds.
8788 #[ must_use]
8889 pub fn platform ( mut self , platform : impl Into < String > ) -> Self {
8990 self . inner = self . inner . platform ( platform) ;
9091 self
9192 }
9293
93- /// Enable `BuildKit` backend
94+ /// Enables `BuildKit` backend.
9495 #[ must_use]
9596 pub fn buildkit ( mut self ) -> Self {
9697 // This would normally set DOCKER_BUILDKIT=1 environment variable
@@ -102,35 +103,35 @@ impl BuilderBuildCommand {
102103 self
103104 }
104105
105- /// Enable quiet mode
106+ /// Enables quiet mode.
106107 #[ must_use]
107108 pub fn quiet ( mut self ) -> Self {
108109 self . inner = self . inner . quiet ( ) ;
109110 self
110111 }
111112
112- /// Always remove intermediate containers
113+ /// Always removes intermediate containers.
113114 #[ must_use]
114115 pub fn force_rm ( mut self ) -> Self {
115116 self . inner = self . inner . force_rm ( ) ;
116117 self
117118 }
118119
119- /// Remove intermediate containers after successful build (default)
120+ /// Removes intermediate containers after successful build (default).
120121 #[ must_use]
121122 pub fn rm ( self ) -> Self {
122123 // rm is the default behavior, this is a no-op
123124 self
124125 }
125126
126- /// Do not remove intermediate containers after build
127+ /// Does not remove intermediate containers after build.
127128 #[ must_use]
128129 pub fn no_rm ( mut self ) -> Self {
129130 self . inner = self . inner . no_rm ( ) ;
130131 self
131132 }
132133
133- /// Always attempt to pull newer version of base image
134+ /// Always attempts to pull newer version of base image.
134135 #[ must_use]
135136 pub fn pull ( mut self ) -> Self {
136137 self . inner = self . inner . pull ( ) ;
@@ -142,7 +143,7 @@ impl BuilderBuildCommand {
142143impl DockerCommand for BuilderBuildCommand {
143144 type Output = BuildOutput ;
144145
145- fn command_name ( ) -> & str {
146+ fn command_name ( ) -> & ' static str {
146147 "builder build"
147148 }
148149
@@ -155,15 +156,15 @@ impl DockerCommand for BuilderBuildCommand {
155156 }
156157
157158 fn build_command_args ( & self ) -> Vec < String > {
158- self . inner . build_command_args ( ) ;
159+ self . inner . build_command_args ( )
159160 }
160161
161162 async fn execute ( & self ) -> Result < Self :: Output > {
162- // The builder build command has the same output as regular build
163+ // the builder build command has the same output as regular build
163164 let args = self . build_command_args ( ) ;
164165 let output = self . inner . executor . execute_command ( "docker" , args) . await ?;
165166
166- // Extract image ID from output
167+ // extract image ID from output
167168 let image_id = extract_image_id ( & output. stdout ) ;
168169
169170 Ok ( BuildOutput {
@@ -175,9 +176,9 @@ impl DockerCommand for BuilderBuildCommand {
175176 }
176177}
177178
178- /// Extract image ID from build output
179+ /// Extracts image ID from build output.
179180fn extract_image_id ( stdout : & str ) -> Option < String > {
180- // Look for "Successfully built <id>" or "writing image sha256:<id>"
181+ // look for "Successfully built <id>" or "writing image sha256:<id>"
181182 for line in stdout. lines ( ) . rev ( ) {
182183 if line. contains ( "Successfully built" ) {
183184 return line. split_whitespace ( ) . last ( ) . map ( String :: from) ;
0 commit comments