Skip to content

fix(ecr-assets): honor <dockerfile>.dockerignore when staging DockerImageAsset - #38635

Open
hassaku63 wants to merge 4 commits into
aws:mainfrom
hassaku63:fix/issue-17686-dockerfile-dockerignore
Open

fix(ecr-assets): honor <dockerfile>.dockerignore when staging DockerImageAsset#38635
hassaku63 wants to merge 4 commits into
aws:mainfrom
hassaku63:fix/issue-17686-dockerfile-dockerignore

Conversation

@hassaku63

Copy link
Copy Markdown
Contributor

Issue # (if applicable)

Closes #17686

Reason for this change

Multiple DockerImageAsset resources often share one build context but use different Dockerfiles, each with its own <dockerfile>.dockerignore. CDK staging only read the context-root .dockerignore, so per-image ignore rules were not applied and assetHash included unrelated files. Docker already supports Dockerfile-specific ignore files; CDK did not.

Description of changes

Adds ApiDefault flag @aws-cdk/aws-ecr-assets:dockerfileSpecificIgnoreFile so staging follows Docker's ignore-file selection when enabled. Existing apps keep current behavior until the flag is set. No new construct props. README and feature-flag docs updated.

Describe any new or updated permissions being added

None

Description of how you validated changes

unit, integ test

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…ssets (under feature flag)

DockerImageAsset always read context-root .dockerignore. Match Docker's sibling ignore file behind an ApiDefault flag so existing apps stay on the historic behavior.
Inline flag-off expectations and simplify describe title after review feedback.
Deploy-time pass oracle with Dockerfile.Custom and sibling ignore; flag enabled via postCliContext.
Remove redundant .dockerignore and keep-me.txt; regenerate snapshot for
the 3-file fixture and updated pass-oracle Dockerfile comments.
@hassaku63
hassaku63 deployed to automation August 22, 2026 14:17 — with GitHub Actions Active
@hassaku63
hassaku63 deployed to automation August 22, 2026 14:17 — with GitHub Actions Active
@github-actions github-actions Bot added bug This issue is a bug. p2 repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK labels Aug 22, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team August 22, 2026 14:17
@hassaku63
hassaku63 deployed to automation August 22, 2026 14:17 — with GitHub Actions Active

@aws-cdk-automation aws-cdk-automation left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

@hassaku63 hassaku63 changed the title Fix/issue 17686 dockerfile dockerignore fix(ecr-assets): honor <dockerfile>.dockerignore when staging DockerImageAsset Aug 22, 2026
@hassaku63
hassaku63 deployed to automation August 22, 2026 14:20 — with GitHub Actions Active
@aws-cdk-automation
aws-cdk-automation dismissed their stale review August 22, 2026 14:20

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue is a bug. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. repeat-contributor [Pilot] contributed between 3-5 PRs to the CDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-ecr-assets): Dockerfile.dockerignore is not used

2 participants