shy-football-10348
06/10/2020, 12:23 AMurl = ecr.repository_url
or url = ecr['repository_url']
gentle-diamond-70147
06/10/2020, 12:24 AMurl = ecr.repository_url
should work. Are you getting an error when doing that?shy-football-10348
06/10/2020, 12:30 AMrepository_url
in a subprocess commandecr = aws.ecr.Repository(
"jupyterhub",
name="jupyterhub",
image_scanning_configuration={
"scanOnPush": True,
},
image_tag_mutability="MUTABLE"
)
url = ecr.repository_url
url = str(url)
def build_and_push_image(url):
# current_account = aws.get_caller_identity().account_id
# ecr_repo_url = f"{current_account}.<http://dkr.ecr.us-west-2.amazonaws.com/jupyterhub|dkr.ecr.us-west-2.amazonaws.com/jupyterhub>"
image = f"{url}:latest"
subprocess.run(
[
"aws",
"ecr",
"get-login-password",
"--region",
"us-west-2",
"|",
"docker",
"login",
"--username",
"AWS",
"--password-stdin",
f"{url}"
],
cwd="../docker"
)
strong-plastic-28250
06/10/2020, 12:42 AMimage()
along with dockerbuild()
will allow you to build the image locally then push to a remote repository. Also on pulumi_docker github they have examples of the auth structure to ecr so that portions already done for you.shy-football-10348
06/10/2020, 12:49 AMstrong-plastic-28250
06/10/2020, 12:53 AMdockerbuild()
class. There are arguments if you have a custom location for the dockerfile along with the context which is where the configuration is located. Think of it just doing a docker build..
shy-football-10348
06/10/2020, 12:58 AMchilly-hairdresser-56259
06/10/2020, 12:59 AMimage=Image(
name= "%s-v1" % (p_application),
build=DockerBuild(
dockerfile = "../folder/single.Dockerfile",
context = "../folder"
),
image_name = pulumi.Output.all(repo.repository_url, buildId).apply(lambda vals: f"""{vals[0]}:{vals[1]}"""),
registry = registry
)
Output().apply()
shy-football-10348
06/10/2020, 1:23 AM