Skip to content

feat(lambda): add docker platform support for lambda#21405

Merged
mergify[bot] merged 17 commits intoaws:mainfrom
yakirza17:support_platform_flag_for_docker_image
Aug 3, 2022
Merged

feat(lambda): add docker platform support for lambda#21405
mergify[bot] merged 17 commits intoaws:mainfrom
yakirza17:support_platform_flag_for_docker_image

Conversation

@yakirza17
Copy link
Copy Markdown
Contributor

@yakirza17 yakirza17 commented Aug 1, 2022

Based on this PR
Add the missing part to add platform support when using lambda fromImageAsset

As we are not allowed to specify platform flag for DockerImageAsset, users deploying cdk on x86_64 platform will not be able to bundle lambda.DockerImageFunction for the new arm64 architecture. Similarly, users deploying cdk on arm64 architecture like Mac M1 will not be able to bundle images for AWS Fargate, which is x86_64 only.

builder experience with aws-lambda

For x86_64 users deploying Lambda functions with container runtime on Lambda Graviton2(arm64) from local container image assets with multi-architecture docker base images. Specify the platform to ensure the image would be built for ARM64 architecture.

 new DockerImageFunction(stack, 'Lambda', {
      code: DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')),
      architecture: Architecture.ARM_64,
    });

Fixes: #12472, #20907

All Submissions:

Adding new Unconventional Dependencies:

  • This PR adds new unconventional dependencies following the process described here

New Features

  • Have you added the new feature to an integration test?
    • Did you use yarn integ to deploy the infrastructure and generate the snapshot (i.e. yarn integ without --dry-run)?

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@gitpod-io
Copy link
Copy Markdown

gitpod-io bot commented Aug 1, 2022

@github-actions github-actions bot added the p2 label Aug 1, 2022
@aws-cdk-automation aws-cdk-automation requested a review from a team August 1, 2022 09:49
@mrgrain
Copy link
Copy Markdown
Contributor

mrgrain commented Aug 1, 2022

Hi @yakirza17 thanks a lot for your contribution! We will definitely need some tests for this (unit + integration) and an example in the README.

Additionally, since this is based on another PR, could you briefly explain if and how you've addressed the feedback that the original PR #16770 received?

@yakirza17
Copy link
Copy Markdown
Contributor Author

Hi @mrgrain,
I added an update to the readme and a relevant test (taken from the PR)

Most of the changes that were in the original PR have already entered main, the only change that is missing is in aws-lambda and I only added it, along the way I corrected relevant comments given to the original PR.

Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the integration test documentation for writing new integration tests.

@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 2, 2022 11:43

Pull request has been modified.

Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few comments here inline. Please also review our documentation on writing PRs and make edits to align with those standards. Title is fine, body needs more details. Also, it looks like the issue that this should link is #20907

Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 3, 2022 05:31

Pull request has been modified.

Co-authored-by: Kendra Neil <53584728+TheRealAmazonKendra@users.noreply.github.com>
@mergify mergify bot dismissed TheRealAmazonKendra’s stale review August 3, 2022 05:57

Pull request has been modified.

Copy link
Copy Markdown
Contributor

@TheRealAmazonKendra TheRealAmazonKendra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all your work on this!

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 3, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Copy Markdown
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 4cb0d2e
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 48178ac into aws:main Aug 3, 2022
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Aug 3, 2022

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mrgrain mrgrain added the effort/small Small work item – less than a day of effort label Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(assets): allow user to pass platform option to Docker builds

4 participants