File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -45,14 +45,28 @@ def __init__(
4545 os .makedirs (self .host_results_path )
4646
4747 def _build_docker_image (self ):
48+ from docker .errors import BuildError
49+
4850 logger .info ("Building image" )
49- image , _ = self .docker_client .images .build (
50- path = self .dockerfile_path ,
51- tag = self .tool_name ,
52- dockerfile = self .dockerfile_name ,
53- nocache = self .nocache ,
54- )
55- return image
51+ try :
52+ image , logs = self .docker_client .images .build (
53+ path = self .dockerfile_path ,
54+ tag = self .tool_name ,
55+ dockerfile = self .dockerfile_name ,
56+ nocache = self .nocache ,
57+ )
58+ for chunk in logs :
59+ if 'stream' in chunk :
60+ print (chunk ['stream' ], end = '' )
61+
62+ return image
63+ except BuildError as e :
64+ for chunk in e .build_log or []:
65+ if 'stream' in chunk :
66+ print (chunk ['stream' ], end = '' )
67+ elif 'errorDetail' in chunk :
68+ print (chunk ['errorDetail' ].get ('message' , '' ))
69+ raise
5670
5771 def spawn_docker_instance (self ):
5872 logger .info ("Creating container" )
You can’t perform that action at this time.
0 commit comments