Skip to content

Commit

Permalink
resolving docker build issue
Browse files Browse the repository at this point in the history
  • Loading branch information
BabaYaga1221 committed May 6, 2023
1 parent 8cfe4a1 commit 77a6d2c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/rocker/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def get_docker_client():
def docker_build(docker_client = None, output_callback = None, **kwargs):
image_id = None
build_success = False
build_output = []
error_message = []

if not docker_client:
docker_client = get_docker_client()
Expand All @@ -149,17 +149,20 @@ def docker_build(docker_client = None, output_callback = None, **kwargs):
continue
if output_callback is not None:
output_callback(output)
build_output.append(output)

match = re.match(r'Successfully built ([a-z0-9]{12})', output)
if match:
image_id = match.group(1)
build_success = True
elif "error" in output.lower():
error_message.append(output)


if build_success:
return image_id
else:
raise Exception("Build failed: "+"\n".join(build_output))
error_msg = "\n".join(error_message)
raise Exception(f"Build failed:\n{error_msg}")


class SIGWINCHPassthrough(object):
Expand Down

0 comments on commit 77a6d2c

Please sign in to comment.