aws-lambda-python-alpha: `PythonFunction` requires 4 minutes to build and produces a 3GB Docker image
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
### Describe the bug
The Docker image for this Lambda function was built on an AMD Ryzen 5 7600X CPU.
The resulting image size of 3GB is highly excessive, especially considering that the final Lambda function deployment package is only 3.6MB.



### Regression Issue
- [ ] Select this option if this issue appears to be a regression.
### Last Known Working CDK Version
_No response_
### Expected Behavior
See above.
### Current Behavior
See above.
### Reproduction Steps
See above.
### Possible Solution
Refactor the [Dockerfile](https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-lambda-python-alpha/lib/Dockerfile).
### Additional Information/Context
Related issue: #32413
### CDK CLI Version
2.173.3
### Framework Version
_No response_
### Node.js Version
22.12.0
### OS
Ubuntu 24.04.1
### Language
TypeScript
### Language Version
_No response_
### Other information
_No response_
Contributor guide
Research direction
The relevant entry point is packages/@aws-cdk/aws-lambda-python-alpha/lib/Dockerfile. Start by reading that Dockerfile and the related issue #32413, then compare its build output with the reported 3.6MB deployment package. Done means the PythonFunction build no longer takes about four minutes or produces a roughly 3GB image while preserving the deployment package.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, docker, dockerfile, python, typescript
- Domain
- build-system, cloud, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100