Describe the bug
The current documented behavior for the architecture prop on lambda_.DockerImageFunction is:
architecture: The system architectures compatible with this lambda function. Default: Architecture.X86_64
However, I found running cdk deploy on my Mac would not target amd64. This results in the following error message when invoking the deployed Lambda function:
Error: fork/exec /lambda-entrypoint.sh: exec format error Runtime.InvalidEntrypoint
I was able to resolve this by explicitly setting:
lambda_.DockerImageFunction(self, ..., architecture=lambda_.Architecture.X86_64)
Another quirk I found was that specifying --platform in build_args is silently ignored. You can only specify this setting via the platform property.
code=lambda_.DockerImageCode.from_image_asset(
directory=...,
build_args={"--platform": "linux/amd64"}, # doesn't work
platform=ecr_assets.Platform.LINUX_X86_64, # works
),
Expected Behavior
- The
lambda_.DockerImageFunction() default architecture of lambda_.Architecture.X86_64 is passed to docker build
- Allow passing
--platform in build_args or raise an error
Current Behavior
The default value either seems to not be set correctly, or it's not passed correctly to docker build.
Reproduction Steps
Follow the hello world example here.
lambda_.DockerImageFunction(
self,
"HelloWorldLambda",
code=lambda_.DockerImageCode.from_image_asset(
directory=...,
# build_args={"--platform": "linux/amd64"},
# platform=ecr_assets.DockerPlatform.LINUX_X86_64,
),
# architecture=lambda_.Architecture.X86_64,
)
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
v20.16.0
OS
macOS
Language
Python
Language Version
No response
Other information
No response
Describe the bug
The current documented behavior for the
architectureprop onlambda_.DockerImageFunctionis:However, I found running
cdk deployon my Mac would not target amd64. This results in the following error message when invoking the deployed Lambda function:I was able to resolve this by explicitly setting:
Another quirk I found was that specifying
--platforminbuild_argsis silently ignored. You can only specify this setting via theplatformproperty.Expected Behavior
lambda_.DockerImageFunction()default architecture oflambda_.Architecture.X86_64is passed to docker build--platforminbuild_argsor raise an errorCurrent Behavior
The default value either seems to not be set correctly, or it's not passed correctly to docker build.
Reproduction Steps
Follow the hello world example here.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.151.0 (build b8289e2)
Framework Version
No response
Node.js Version
v20.16.0
OS
macOS
Language
Python
Language Version
No response
Other information
No response