Skip to content

Commit

Permalink
chore(doc): improve the doc on DockerImageFunction for cross-platform…
Browse files Browse the repository at this point in the history
… 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*
  • Loading branch information
pahud committed Aug 28, 2024
1 parent 959d71c commit 2a3279d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/aws-cdk-lib/aws-lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ configurations as well as choosing a specific tag or digest. See their docs for
To deploy a `DockerImageFunction` on Lambda `arm64` architecture, specify `Architecture.ARM_64` in `architecture`.
This will bundle docker image assets for `arm64` architecture with `--platform linux/arm64` even if build within an `x86_64` host.

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
need to specify `architecture: lambda.Architecture.X86_64` as well. This ensures the `--platform` argument is passed to the image assets
bundling process so you can bundle up `X86_64` images from the `arm64` machine.

```ts
new lambda.DockerImageFunction(this, 'AssetFunction', {
code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')),
Expand Down

0 comments on commit 2a3279d

Please sign in to comment.