chore: use arm64 architecture image for lambda
This commit is contained in:
@@ -16,12 +16,17 @@ AWS_REGIONS=("us-east-1") # List of AWS region, use below liest if you don't ena
|
||||
build_and_push_images() {
|
||||
local IMAGE_NAME=$1
|
||||
local TAG=$2
|
||||
local ENABLE_MULTI_ARCH=${3:-true} # a parameter for enabling multi-arch build or not, the default is true
|
||||
|
||||
# Build Docker image for each architecture
|
||||
if [ "$ENABLE_MULTI_ARCH" == "true" ]; then
|
||||
for ARCH in "${ARCHS[@]}"
|
||||
do
|
||||
docker buildx build --platform linux/$ARCH -t $IMAGE_NAME:$TAG-$ARCH -f ../src/Dockerfile_ecs --load ../src/
|
||||
done
|
||||
else
|
||||
docker buildx build --platform linux/${ARCHS[0]} -t $IMAGE_NAME:$TAG -f ../src/Dockerfile_ecs --load ../src/
|
||||
fi
|
||||
|
||||
# Push Docker image to ECR for each architecture in each AWS region
|
||||
for REGION in "${AWS_REGIONS[@]}"
|
||||
@@ -39,6 +44,7 @@ build_and_push_images() {
|
||||
aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REPOSITORY_URI
|
||||
|
||||
# Push the image to ECR for each architecture
|
||||
if [ "$ENABLE_MULTI_ARCH" == "true" ]; then
|
||||
for ARCH in "${ARCHS[@]}"
|
||||
do
|
||||
# Tag the image for the current region
|
||||
@@ -53,10 +59,16 @@ build_and_push_images() {
|
||||
|
||||
# Push the manifest to ECR
|
||||
docker manifest push $REPOSITORY_URI:$TAG
|
||||
else
|
||||
# Tag the image for the current region
|
||||
docker tag $IMAGE_NAME:$TAG $REPOSITORY_URI:$TAG
|
||||
# Push the image to ECR
|
||||
docker push $REPOSITORY_URI:$TAG
|
||||
fi
|
||||
|
||||
echo "Pushed $IMAGE_NAME:$TAG to $REPOSITORY_URI"
|
||||
done
|
||||
}
|
||||
|
||||
build_and_push_images "bedrock-proxy-api" "$TAG"
|
||||
build_and_push_images "bedrock-proxy-api" "$TAG" "false"
|
||||
build_and_push_images "bedrock-proxy-api-ecs" "$TAG"
|
||||
|
||||
Reference in New Issue
Block a user