Skip to content

Commit

Permalink
Specify correct platform when building docker images (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
bnusunny authored Jan 10, 2024
1 parent d1412da commit 60edfdb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ clean:
rm -rf target

build-builder-x86:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.builder --build-arg ARCH=x86_64 -t public.ecr.aws/awsguru/rust-builder:latest-x86_64 .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.builder --platform linux/amd64 --build-arg ARCH=x86_64 -t public.ecr.aws/awsguru/rust-builder:latest-x86_64 .

build-builder-arm64:
DOCKER_BUILDKIT=1 docker build -f Dockerfile.builder --build-arg ARCH=aarch64 -t public.ecr.aws/awsguru/rust-builder:latest-aarch64 .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.builder --platform linux/arm64 --build-arg ARCH=aarch64 -t public.ecr.aws/awsguru/rust-builder:latest-aarch64 .

build-builder: build-builder-x86 build-builder-arm64
docker push public.ecr.aws/awsguru/rust-builder:latest-x86_64
Expand All @@ -22,10 +22,10 @@ publish-builder:
docker manifest push public.ecr.aws/awsguru/rust-builder:latest

build-x86:
DOCKER_BUILDKIT=1 docker build --build-arg TARGET_PLATFORM=linux/amd64 --build-arg ARCH=x86_64 -t public.ecr.aws/awsguru/aws-lambda-adapter:$(CARGO_PKG_VERSION)-x86_64 .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 --build-arg TARGET_PLATFORM=linux/amd64 --build-arg ARCH=x86_64 -t public.ecr.aws/awsguru/aws-lambda-adapter:$(CARGO_PKG_VERSION)-x86_64 .

build-arm:
DOCKER_BUILDKIT=1 docker build --build-arg TARGET_PLATFORM=linux/arm64 --build-arg ARCH=aarch64 -t public.ecr.aws/awsguru/aws-lambda-adapter:$(CARGO_PKG_VERSION)-aarch64 .
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 --build-arg TARGET_PLATFORM=linux/arm64 --build-arg ARCH=aarch64 -t public.ecr.aws/awsguru/aws-lambda-adapter:$(CARGO_PKG_VERSION)-aarch64 .

build: build-x86 build-arm
docker push public.ecr.aws/awsguru/aws-lambda-adapter:$(CARGO_PKG_VERSION)-x86_64
Expand All @@ -41,15 +41,15 @@ publish:

build-mac:
CC=x86_64-unknown-linux-musl-gcc cargo build --release --target=x86_64-unknown-linux-musl
DOCKER_BUILDKIT=1 docker build -f Dockerfile.mac --build-arg ARCH=x86_64 -t aws-lambda-adapter:latest .
DOCKER_BUILDKIT=1 docker build -f Dockerfile.mac --platform linux/amd64 --build-arg ARCH=x86_64 -t aws-lambda-adapter:latest .

build-LambdaAdapterLayerX86:
cp layer/* $(ARTIFACTS_DIR)/
DOCKER_BUILDKIT=1 docker build --build-arg TARGET_PLATFORM=linux/amd64 --build-arg ARCH=x86_64 -o $(ARTIFACTS_DIR)/extensions .
DOCKER_BUILDKIT=1 docker build --platform linux/amd64 --build-arg TARGET_PLATFORM=linux/amd64 --build-arg ARCH=x86_64 -o $(ARTIFACTS_DIR)/extensions .

build-LambdaAdapterLayerArm64:
cp layer/* $(ARTIFACTS_DIR)/
DOCKER_BUILDKIT=1 docker build --build-arg TARGET_PLATFORM=linux/arm64 --build-arg ARCH=aarch64 -o $(ARTIFACTS_DIR)/extensions .
DOCKER_BUILDKIT=1 docker build --platform linux/arm64 --build-arg TARGET_PLATFORM=linux/arm64 --build-arg ARCH=aarch64 -o $(ARTIFACTS_DIR)/extensions .

fmt:
cargo fmt --all

0 comments on commit 60edfdb

Please sign in to comment.