-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(@aws-cdk/aws-ecr-assets): DockerImageAsset - support --build-context
flag
#31598
Comments
--build-context
--build-context
flag
Hi @BwL1289 , thanks for reaching out. I see this request raised in the past - #3342 but few workaround were suggested - #3342 (comment) as in favor of not implementing this flag. For now, you could use this However given the context of usage and support, this would be good to have. So I am marking this as P3 which means it won't be immediately addressed by the team but is open for team as well as community contribution. |
@khushail this is different than #3342, and there's no obvious workaround I can think of. Docker now supports multiple build contexts through the use of the Per the article I referenced, here's an example:
Please let me know if this makes sense. |
@khushail this doesn't seem that difficult, though I would create a PR but my TS skills are shaky at best. Let me know how I can help. |
@BwL1289 , thanks for clarification and volunteering to contribute. There are many ways for seeking support and help on this request--
hope that would be helpful! |
Describe the feature
We use CDK Pipelines to deploy our infrastructure to dev, staging, and prod accounts.
When we are building dockerfiles using
DockerImageAsset
s, if there are any files/directories the dockerfile needs while being built, we currently have to copy them over any files/directories to the directory where the dockerfile is being built. This is cumbersome and error prone.Docker now supports (since 2022) the ability to specify multiple build contexts via the
--build-context
flag.It would be great to add
--build-context
to the flags supported here.Here's an example:
Then, we can use the following in the dockerfile like so:
COPY --from=example_build_context_1 ...
Use Case
With
--build-context
now supported, It's unnecessary to copy any additional files/directories into the build context where you are building your image.Proposed Solution
Support the
--build-context
flag.Other Information
No response
Acknowledgements
CDK version used
2.158.0
Environment details (OS name and version, etc.)
macOS Sonoma 14.5, AWS CodeBuild
The text was updated successfully, but these errors were encountered: