in docker_utils.py [0:0]
def push(tag, aws_account=None, aws_region=None):
"""
Push the builded tag to ECR.
Args:
tag (string): tag which you named your algo
aws_account (string): aws account of the ECR repo
aws_region (string): aws region where the repo is located
Returns:
(string): ECR repo image that was pushed
"""
session = boto3.Session()
aws_account = aws_account or session.client("sts").get_caller_identity()['Account']
aws_region = aws_region or session.region_name
try:
repository_name, version = tag.split(':')
except ValueError: # split failed because no :
repository_name = tag
version = "latest"
ecr_client = session.client('ecr', region_name=aws_region)
_create_ecr_repo(ecr_client, repository_name)
_ecr_login(ecr_client, aws_account)
ecr_tag = _push(aws_account, aws_region, tag)
return ecr_tag