I'm using Pulumi to try and create an EBS application. As part of this I need to push a new docker image to ECR.
I need to push the image after the docker registry has been created but before the beanstalk application version tries to update to the new image.
I have the following code, but want push_image_to_repository()
to be somehow called after the ecr.Repository
has been created (ignore the ugly os.sytem
call, that will be removed later).
application = Application(resource_name=ENV_APP_NAME, name=ENV_APP_NAME)
repository = ecr.Repository(resource_name=APP_NAME, name=APP_NAME)
image_tag = artifact_path.name.replace(".zip", "")
def push_image_to_repository(arn):
upstream = f'{arn}/{image_tag}'
os.system(f'make -C . push UPSTREAM={upstream}')
app_version = ApplicationVersion(
resource_name=ENV_APP_NAME,
application=application,
bucket=releases_bucket.id,
key=artifact_path.name,
)
environment = Environment(
application=application,
resource_name=ENV_APP_NAME,
name=ENV_APP_NAME,
solution_stack_name=STACK,
settings=BEANSTALK_ENVIRONMENT_SETTINGS,
wait_for_ready_timeout=BEANSTALK_ENVIRONMENT_TIMEOUT,
version=app_version,
)
How can I go about doing this?