Helper to create a container image from ECR using CDK context for versioning.
Reads imageVersion from CDK context (--context imageVersion=<tag>). This allows passing the image tag from CI/CD workflows at deployment time.
imageVersion
--context imageVersion=<tag>
// Using defaults (Production account, stack's region)const { image, imageVersion } = EcrContainerImage.fromContext(this, 'AppImage', { repositoryName: 'my-app',});// Or with custom account/regionconst { image, imageVersion } = EcrContainerImage.fromContext(this, 'AppImage', { repositoryName: 'my-app', ecrAccountId: '123456789012', region: 'us-east-1',}); Copy
// Using defaults (Production account, stack's region)const { image, imageVersion } = EcrContainerImage.fromContext(this, 'AppImage', { repositoryName: 'my-app',});// Or with custom account/regionconst { image, imageVersion } = EcrContainerImage.fromContext(this, 'AppImage', { repositoryName: 'my-app', ecrAccountId: '123456789012', region: 'us-east-1',});
Static
Creates a container image from an ECR repository using the image version from CDK context.
The construct scope.
The construct ID for the ECR repository reference.
Configuration for the ECR repository.
The container image and version.
Error if imageVersion context is not provided.
Helper to create a container image from ECR using CDK context for versioning.
Reads
imageVersionfrom CDK context (--context imageVersion=<tag>). This allows passing the image tag from CI/CD workflows at deployment time.Example