aws cdk 将图像推送到 ecr
aws cdk push image to ecr
我正在尝试做一些看起来相当合乎逻辑且直接的事情。
我正在使用 AWS CDK 来配置一个 ecr 存储库:
repository = ecr.Repository(
self,
id="Repo",
repository_name=ecr_repo_name,
removal_policy=core.RemovalPolicy.DESTROY
)
然后我有一个 Dockerfile,它位于我的项目的根目录下,我试图将其推送到部署中的同一个 ECR 存储库。
我在相同的服务代码中执行此操作:
assets = DockerImageAsset(
self,
"S3_text_image",
directory=str(Path(__file__).parent.parent),
repository_name=ecr_repo_name
)
部署正常并继续进行并创建了 ECR 存储库,但映像被推送到默认位置 aws-cdk/assets
如何让部署将我的 Dockerfile 发送到我希望它驻留的确切 ECR 存储库?
AWS CDK 在 DockerImageAsset
上描述了 repositoryName
属性。 GitHub 上有几个问题引用了这个问题。请参阅其中一位开发人员的 this comment:
At the moment the CDK comes with 2 asset systems:
The legacy one (currently still the default), where you get to specify a repositoryName per asset, and the CLI will create and push to whatever ECR repository you name.
The new one (will become the default in the future), where a single ECR repository will be created by doing cdk bootstrap and all images will be pushed into it. The CLI will not create the repository any more, it must already exist. IIRC this was done to limit the permissions required for deployments. @eladb, can you help me remember why we chose to do it this way?
有一个新结构的请求,它将允许您部署到位于 (aws-ecr-assets) ecr-deployment #12597 的自定义 ECR 存储库。
Use Case
I would like to use this feature to completely deploy my local image source code to ECR for me using an ECR repo that I have previously created in my CDK app or more importantly outside the app using an arn. The biggest problem is that the image cannot be completely abstracted into the assets repo because of auditing and semantic versioning.
如果您不想等待 CDK 团队实施新构造,https://github.com/wchaws/cdk-ecr-deployment 也有第三方解决方案。
我正在尝试做一些看起来相当合乎逻辑且直接的事情。
我正在使用 AWS CDK 来配置一个 ecr 存储库:
repository = ecr.Repository(
self,
id="Repo",
repository_name=ecr_repo_name,
removal_policy=core.RemovalPolicy.DESTROY
)
然后我有一个 Dockerfile,它位于我的项目的根目录下,我试图将其推送到部署中的同一个 ECR 存储库。
我在相同的服务代码中执行此操作:
assets = DockerImageAsset(
self,
"S3_text_image",
directory=str(Path(__file__).parent.parent),
repository_name=ecr_repo_name
)
部署正常并继续进行并创建了 ECR 存储库,但映像被推送到默认位置 aws-cdk/assets
如何让部署将我的 Dockerfile 发送到我希望它驻留的确切 ECR 存储库?
AWS CDK 在 DockerImageAsset
上描述了 repositoryName
属性。 GitHub 上有几个问题引用了这个问题。请参阅其中一位开发人员的 this comment:
At the moment the CDK comes with 2 asset systems:
The legacy one (currently still the default), where you get to specify a repositoryName per asset, and the CLI will create and push to whatever ECR repository you name.
The new one (will become the default in the future), where a single ECR repository will be created by doing cdk bootstrap and all images will be pushed into it. The CLI will not create the repository any more, it must already exist. IIRC this was done to limit the permissions required for deployments. @eladb, can you help me remember why we chose to do it this way?
有一个新结构的请求,它将允许您部署到位于 (aws-ecr-assets) ecr-deployment #12597 的自定义 ECR 存储库。
Use Case
I would like to use this feature to completely deploy my local image source code to ECR for me using an ECR repo that I have previously created in my CDK app or more importantly outside the app using an arn. The biggest problem is that the image cannot be completely abstracted into the assets repo because of auditing and semantic versioning.
如果您不想等待 CDK 团队实施新构造,https://github.com/wchaws/cdk-ecr-deployment 也有第三方解决方案。