aws-cdk
aws-cdk copied to clipboard
feat(assets): support drop-in docker replacements by setting `$CDK_DOCKER`
This PR introduces the ability for users to change the command used for building and publishing Docker images to a drop-in replacement like the Depot Docker shim. To change the docker command, the user provides the alternative command via an environment variable named CDK_DOCKER.
There's already something similar in core's asset bundling, but it applies only to bundling and not to building and publishing Docker image assets.
https://github.com/aws/aws-cdk/blob/3e55092fb70e0ec74ee7c4144d6e39a29d8757ae/packages/%40aws-cdk/core/lib/bundling.ts#L523
Fixes #21836
All Submissions:
- [x] Have you followed the guidelines in our Contributing guide?
Adding new Unconventional Dependencies:
- [ ] This PR adds new unconventional dependencies following the process described here
New Features
- [ ] Have you added the new feature to an integration test?
- [ ] Did you use
yarn integto deploy the infrastructure and generate the snapshot (i.e.yarn integwithout--dry-run)?
- [ ] Did you use
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Depends-On: https://github.com/aws/aws-cdk/pull/22194
How about getting that custom executable to replace docker to asset step's image(s)? Should custom image be used, some installation added to steps or what? I think this should be mentioned in documentation.
How about getting that custom executable to replace
dockerto asset step's image(s)? Should custom image be used, some installation added to steps or what? I think this should be mentioned in documentation.
@Hi-Fi Thanks for your comments, but I need more clarification. Do you mean to suggest we include documentation on installing third-party tools alongside the AWS CDK and instructions on using those tools with the AWS CDK? i.e., a tutorial on installing and using Depot to build Docker image assets? (curl https://... | sh && env CDK_DOCKER=depot-shim cdk deploy)
How about getting that custom executable to replace
dockerto asset step's image(s)? Should custom image be used, some installation added to steps or what? I think this should be mentioned in documentation.@Hi-Fi Thanks for your comments, but I need more clarification. Do you mean to suggest we include documentation on installing third-party tools alongside the AWS CDK and instructions on using those tools with the AWS CDK? i.e., a tutorial on installing and using Depot to build Docker image assets? (
curl https://... | sh && env CDK_DOCKER=depot-shim cdk deploy)
As asset stage is a bit special in pipelines, and it's configuration is just one that is offered. So documentation should have recommendation if to use custom build image with executable included or add installation command to some assetPublishingCodeBuildDefaults.
Using cdk deploy is different thing, as with that there's no need to worry about stages. And in that I don't think it's needed to tell how to install tool needed.
How about getting that custom executable to replace
dockerto asset step's image(s)? Should custom image be used, some installation added to steps or what? I think this should be mentioned in documentation.@Hi-Fi Thanks for your comments, but I need more clarification. Do you mean to suggest we include documentation on installing third-party tools alongside the AWS CDK and instructions on using those tools with the AWS CDK? i.e., a tutorial on installing and using Depot to build Docker image assets? (
curl https://... | sh && env CDK_DOCKER=depot-shim cdk deploy)As asset stage is a bit special in pipelines, and it's configuration is just one that is offered. So documentation should have recommendation if to use custom build image with executable included or add installation command to some
assetPublishingCodeBuildDefaults.Using cdk deploy is different thing, as with that there's no need to worry about stages. And in that I don't think it's needed to tell how to install tool needed.
@Hi-Fi Thanks for clarifying! I'll take a crack at adding documentation to the CDK Pipelines README as well.
@mergifyio update
update
✅ Branch has been successfully updated
I think the
CDK_DOCKERfeature was mostly intended for testing, but I guess I don't mind supporting this. A couple of doc updates and then this is good to go.
Sounds good. I'll get to these changes this afternoon or evening after work at the latest.
(Sidebar: the more I see and learn about Docker, the less I like supporting it. It seems everyone has very specific opinions on how it should be used in their specific use cases, leading to a proliferation of flags and tweaks that are tough to maintain... 😔)
Agreed. The CDK really took the bull by the horns by tackling the issue of building/publishing containers. I think a lot of users appreciate the help though, myself included.
@mergifyio update
update
✅ Branch has been successfully updated
@mergifyio update
update
✅ Branch has been successfully updated
Needs https://github.com/aws/aws-cdk/pull/22194 to be merged first
@Mergifyio update
update
✅ Branch has been successfully updated
AWS CodeBuild CI Report
- CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
- Commit ID: 241b3242ed61e34ffd3c188fe9e9ad005c6f93f1
- Result: SUCCEEDED
- Build Logs (available for 30 days)
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).