ecr_repo = 'new-containers'
aws_account = '775004277940'
aws_region = 'us-west-2'

registry = f'{aws_account}.dkr.ecr.{aws_region}.amazonaws.com/{ecr_repo}'


containers = [
            {
               'dockerfile' : 'ray/docker/1.6.0/Dockerfile',
               'docker_params': {'AWS_REGION':aws_region,
                 'CPU_OR_GPU':'cpu',
                 'SUFFIX':'py37',
                 'VERSION':'2.5.0',
                 'FRAMEWORK':'tensorflow'
                }
            },

        ]

get_ray_image_tag = lambda ray_version, params : f"ray-{ray_version}-{params['FRAMEWORK']}-{params['CPU_OR_GPU']}-{params['VERSION']}-{params['SUFFIX']}"

for container in containers:
    params = ''.join(f' --build-arg {key}={value}' for key,value in container['docker_params'].items())
    image = get_ray_image_tag('1.6.0', container['docker_params'])
    dockerfile = container['dockerfile']
    print(f'docker build -t {registry}:{image} -f {dockerfile} {params} .')
    print(f'docker push {registry}:{image}"')

#images = ['ray-tf-cpu','ray-torch-cpu','ray-tf-gpu','ray-torch-gpu']

#for build, image in zip(builds[:1], images[:1]):
#    params = ''.join(f' --build-arg {key}={value}' for key,value in build.items())
#    build_cmd = f"docker build -t {registry}:{image} -f ray/docker/1.6.0/Dockerfile {params} ."
#    print (build_cmd)
#    print (push_cmd)   
#    print ('\n')



ecr_repo = 'new-containers'
aws_account = '775004277940'
aws_region = 'us-west-2'

registry = f'{aws_account}.dkr.ecr.{aws_region}.amazonaws.com/{ecr_repo}'


containers = [
            {
               'dockerfile' : 'ray/docker/1.6.0/Dockerfile',
               'docker_params': {'AWS_REGION':aws_region,
                 'CPU_OR_GPU':'cpu',
                 'SUFFIX':'py37',
                 'VERSION':'2.5.0',
                 'FRAMEWORK':'tensorflow'
                }
            },

        ]

get_ray_image_tag = lambda ray_version, params : f"ray-{ray_version}-{params['FRAMEWORK']}-{params['CPU_OR_GPU']}-{params['VERSION']}-{params['SUFFIX']}"

for container in containers:
    params = ''.join(f' --build-arg {key}={value}' for key,value in container['docker_params'].items())
    image = get_ray_image_tag('1.6.0', container['docker_params'])
    dockerfile = container['dockerfile']
    print(f'docker build -t {registry}:{image} -f {dockerfile} {params} .')
    print(f'docker push {registry}:{image}"')

#images = ['ray-tf-cpu','ray-torch-cpu','ray-tf-gpu','ray-torch-gpu']

#for build, image in zip(builds[:1], images[:1]):
#    params = ''.join(f' --build-arg {key}={value}' for key,value in build.items())
#    build_cmd = f"docker build -t {registry}:{image} -f ray/docker/1.6.0/Dockerfile {params} ."
#    print (build_cmd)
#    print (push_cmd)   
#    print ('\n')



#images = ['ray-tf-cpu','ray-torch-cpu','ray-tf-gpu','ray-torch-gpu'] #for build, image in zip(builds[:1], images[:1]): #    params = ''.join(f' --build-arg {key}={value}' for key,value in build.items()) #    build_cmd = f"docker build -t {registry}:{image} -f ray/docker/1.6.0/Dockerfile {params} ." #    print (build_cmd) #    print (push_cmd) #    print ('\n')