Skip to content

Commit 2a3279d

Browse files
authored
chore(doc): improve the doc on DockerImageFunction for cross-platform bundling (#31053)
### Issue # (if applicable) Closes #31048 ### Reason for this change Per discussed #31048 (comment), the `architecture` would still be required when bundling `X86_64` DockerImageFunction from a `arm64` machine like a Macbook with arm64 chip as it explicitly pass the `--platform` argument to `docker build`, which is required in this use case. ### Description of changes ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 959d71c commit 2a3279d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/aws-cdk-lib/aws-lambda/README.md

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ configurations as well as choosing a specific tag or digest. See their docs for
7878
To deploy a `DockerImageFunction` on Lambda `arm64` architecture, specify `Architecture.ARM_64` in `architecture`.
7979
This will bundle docker image assets for `arm64` architecture with `--platform linux/arm64` even if build within an `x86_64` host.
8080

81+
With that being said, if you are bundling `DockerImageFunction` for Lambda `amd64` architecture from a `arm64` machine like a Macbook with `arm64` CPU, you would
82+
need to specify `architecture: lambda.Architecture.X86_64` as well. This ensures the `--platform` argument is passed to the image assets
83+
bundling process so you can bundle up `X86_64` images from the `arm64` machine.
84+
8185
```ts
8286
new lambda.DockerImageFunction(this, 'AssetFunction', {
8387
code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')),

0 commit comments

Comments
 (0)