@@ -156,7 +156,13 @@ def list_images(to_list: List[str]):
156
156
157
157
print ()
158
158
159
- def build_images (to_build : List [str ], organisation : str , no_cache : bool , buildx : bool , platform = "" ):
159
+ def build_images (
160
+ to_build : List [str ],
161
+ organisation : str ,
162
+ no_cache : bool ,
163
+ buildx : bool ,
164
+ platform = "" ,
165
+ ):
160
166
"""Builds one or more images"""
161
167
162
168
change_working_directory ()
@@ -177,11 +183,13 @@ def build_images(to_build: List[str], organisation: str, no_cache: bool, buildx:
177
183
value = argument .value ,
178
184
))
179
185
180
- # Add the prefix "--build-arg " to every entry and join the array to a string
186
+ # Add the prefix "--build-arg " to every entry and
187
+ # join the array to a string
181
188
build_args = " " .join (["--build-arg " + entry for entry in build_args ])
182
189
183
190
if buildx :
184
- command = "docker buildx build --push {args} --platform " + platform + " --file {dockerfile} --tag {name}:{tag} ."
191
+ command = "docker buildx build --push {args} --platform " + \
192
+ platform + " --file {dockerfile} --tag {name}:{tag} ."
185
193
else :
186
194
command = "docker build -t {name}:{tag} -f {dockerfile} {args} ."
187
195
@@ -232,7 +240,11 @@ def parse_images(to_parse: List[str]) -> List[str]:
232
240
233
241
BUILD_PARSER .add_argument ("images" , type = str , nargs = "*" )
234
242
BUILD_PARSER .add_argument ("--no-cache" , dest = "no_cache" , action = "store_true" )
235
- BUILD_PARSER .add_argument ("--organisation" , default = "boltz" , help = "The organisation to use for the image names" )
243
+ BUILD_PARSER .add_argument (
244
+ "--organisation" ,
245
+ default = "boltz" ,
246
+ help = "The organisation to use for the image names" ,
247
+ )
236
248
237
249
BUILDX_PARSER .add_argument ("images" , type = str , nargs = "*" )
238
250
BUILDX_PARSER .add_argument ("--no-cache" , dest = "no_cache" , action = "store_true" )
@@ -241,7 +253,11 @@ def parse_images(to_parse: List[str]) -> List[str]:
241
253
default = "linux/amd64,linux/arm64" ,
242
254
help = "The platforms to build for" ,
243
255
)
244
- BUILDX_PARSER .add_argument ("--organisation" , default = "boltz" , help = "The organisation to use for the image names" )
256
+ BUILDX_PARSER .add_argument (
257
+ "--organisation" ,
258
+ default = "boltz" ,
259
+ help = "The organisation to use for the image names" ,
260
+ )
245
261
246
262
ARGS = PARSER .parse_args ()
247
263
@@ -252,4 +268,10 @@ def parse_images(to_parse: List[str]) -> List[str]:
252
268
elif ARGS .command == "build" :
253
269
build_images (PARSED_IMAGES , ARGS .organisation , ARGS .no_cache , False )
254
270
elif ARGS .command == "buildx" :
255
- build_images (PARSED_IMAGES , ARGS .organisation , ARGS .no_cache , True , ARGS .platform )
271
+ build_images (
272
+ PARSED_IMAGES ,
273
+ ARGS .organisation ,
274
+ ARGS .no_cache ,
275
+ True ,
276
+ ARGS .platform ,
277
+ )
0 commit comments