Skip to content

Commit

Permalink
chore(ecr-assets): reference cdk-ecr-deployment in readme (aws#14488)
Browse files Browse the repository at this point in the history
As a possible solution for aws#12597, refer to the 3rd-party module `cdk-ecr-deployment` which supports deploying image assets to a specific ECR repository.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
Elad Ben-Israel authored and hollanddd committed Aug 26, 2021
1 parent 39236fa commit 5dd5826
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,38 @@ const asset = new DockerImageAsset(this, 'MyBuildImage', {
})
```

## Publishing images to ECR repositories

`DockerImageAsset` is designed for seamless build & consumption of image assets by CDK code deployed to multiple environments
through the CDK CLI or through CI/CD workflows. To that end, the ECR repository behind this construct is controlled by the AWS CDK.
The mechanics of where these images are published and how are intentionally kept as an implementation detail, and the construct
does not support customizations such as specifying the ECR repository name or tags.

If you are looking for a way to _publish_ image assets to an ECR repository in your control, you should consider using
[wchaws/cdk-ecr-deployment], which is able to replicate an image asset from the CDK-controlled ECR repository to a repository of
your choice.

Here an example from the [wchaws/cdk-ecr-deployment] project:

```ts
import * as ecrdeploy from 'cdk-ecr-deployment';

const image = new DockerImageAsset(this, 'CDKDockerImage', {
directory: path.join(__dirname, 'docker'),
});

new ecrdeploy.ECRDeployment(this, 'DeployDockerImage', {
src: new ecrdeploy.DockerImageName(image.imageUri),
dest: new ecrdeploy.DockerImageName(`${cdk.Aws.ACCOUNT_ID}.dkr.ecr.us-west-2.amazonaws.com/test:nginx`),
});
```

⚠️ Please note that this is a 3rd-party construct library and is not officially supported by AWS.
You are welcome to +1 [this GitHub issue](https://github.com/aws/aws-cdk/issues/12597) if you would like to see
native support for this use-case in the AWS CDK.

[wchaws/cdk-ecr-deployment]: https://github.com/wchaws/cdk-ecr-deployment

## Pull Permissions

Depending on the consumer of your image asset, you will need to make sure
Expand Down

0 comments on commit 5dd5826

Please sign in to comment.