aws-lambda: DockerImageCode.fromImageAsset not caching as-expected #29240
Labels
@aws-cdk/aws-lambda
Related to AWS Lambda
bug
This issue is a bug.
p2
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Describe the bug
I have a simple Dockerfile:
If I build this outside of CDK, the caching works as-expected in that the
RUN pip install
command only runs ifrequirements.txt
changes, otherwise the cache is used.When I build it inside CDK, e.g.:
The
pip install
re-runs any time the code changes, event ifrequirements.txt
is unchanged. I'm guessing that's related to theDockerfile
,requirements
, and app code all being part of the same new asset, e.g.:Is it possible to refactor the CDK code to allow caching? Is there a way for me to merge two assets in a single build, so the Dockerfile and requirements.txt don't get duplicated in a new hash?
Expected Behavior
CDK docker build caches in the same way as outside of CDK.
Current Behavior
CDK build requires rerunning lengthy steps.
Reproduction Steps
See above.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.128.0
Framework Version
No response
Node.js Version
v20.11.0
OS
OSX
Language
Python
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: