core: add --pull
option to DockerBuldOptions
to allow force pull of referenced images
#33400
Open
1 of 2 tasks
Labels
@aws-cdk/core
Related to core CDK functionality
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
We add a
readonly alwaysPullReference?: boolean
to theDockerBuildOptions
interface, which is then used in thedockerArgs
to add a--pull
argument to thedocker build
command. This will allow users to run thedocker build
command which always tries to use the most recent referenced images.Use Case
In the
docker build
step, we allow the user to turn caching off viacacheDisabled
. When deploying a stack locally, I want to make sure that my referenced images in Dockerfiles inFROM some/remote:tag
are up to date. Thedocker build --pull
command does this by basically in-lining adocker pull some/remote:tag; docker build
. This is more surgical than a--no-cache
since--no-cache
invalidates all layers. However, in thebuild --pull
case, if the referenced image is up-to-date, all the existing layers are in sync; or if it is not, only the stages that rely on the now updated reference image will need new layers.Proposed Solution
Add a line herehttps://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/core/lib/bundling.ts#L361:
Other Information
No response
Acknowledgements
CDK version used
2.178.1
Environment details (OS name and version, etc.)
Ubuntu 20.04 (WSL)
The text was updated successfully, but these errors were encountered: