(core): Allow DockerImage.fromBuild to opt out of fingerprint logic
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
Add an option in `DockerImage.fromBuild` to allow skipping the fingerprint generation step.
### Use Case
Currently when [this code](https://github.com/aws/aws-cdk/blob/b70a5fa77c5861ef955b86097583bf3e6f8405f2/packages/%40aws-cdk/core/lib/bundling.ts#L247) builds a docker image it runs a function to ensure that an image has a stable hash. This function reads every file in docker source directory which can be excessively slow for big directories.
I only use the image as in another bundling step to process an asset, so I will never care about it having a stable hash. Since I need to build the image from the root the `fingerprint` function eats up 75% of the total execution time, even though I have absolutely no need for that hash, or that image after I have used it for the bundling step it's meant to do.
### Proposed Solution
Add a `skipFingerprint` option to `DockerBuildOptions`. Use that to skip the fingerprint step if it's set.
* [x] :wave: I may be able to implement this feature request
* [ ] :warning: This feature might incur a breaking change
---
This is a :rocket: Feature Request
Contributor guide
Research direction
Start in packages/@aws-cdk/core/lib/bundling.ts around the Docker image build and fingerprint generation, then locate the DockerBuildOptions definition and related tests. Trace how the option reaches the build path; done means DockerImage.fromBuild can skip fingerprinting when requested while preserving the existing default behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- build-system, devtools
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100