Skip to content

Commit b1ad49f

Browse files
chore: Added example for how to build container images with different architectures (#344)
Co-authored-by: Anton Babenko <[email protected]>
1 parent bb43127 commit b1ad49f

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ Q4: What does this error mean - `"We currently do not support adding policies fo
580580
## Examples
581581

582582
- [Complete](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/complete) - Create Lambda resources in various combinations with all supported features.
583-
- [Container Image](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/container-image) - Create Docker image (using [docker provider](https://registry.terraform.io/providers/kreuzwerker/docker)), push it to AWS ECR, and create Lambda function from it.
583+
- [Container Image](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/container-image) - Create a Docker image with a platform specified in the Dockerfile (using [docker provider](https://registry.terraform.io/providers/kreuzwerker/docker)), push it to AWS ECR, and create Lambda function from it.
584584
- [Build and Package](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/build-package) - Build and create deployment packages in various ways.
585585
- [Alias](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/alias) - Create static and dynamic aliases in various ways.
586586
- [Deploy](https://github.com/terraform-aws-modules/terraform-aws-lambda/tree/master/examples/deploy) - Complete end-to-end build/update/deploy process using AWS CodeDeploy.

examples/container-image/context/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
FROM scratch
1+
# `--platform` argument is used to be able to build docker images when using another platform (e.g. Apple M1)
2+
FROM --platform=linux/x86_64 scratch
23

34
ARG FOO
45

examples/container-image/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ module "lambda_function_from_container_image" {
3434
##################
3535
# Container Image
3636
##################
37-
image_uri = module.docker_image.image_uri
38-
package_type = "Image"
37+
image_uri = module.docker_image.image_uri
38+
package_type = "Image"
39+
architectures = ["x86_64"]
3940
}
4041

4142
module "docker_image" {

0 commit comments

Comments
 (0)