Skip to content

Commit

Permalink
Update deploy.sh script to check and create ECR repository
Browse files Browse the repository at this point in the history
  • Loading branch information
mathewsrc committed Feb 23, 2024
1 parent eded05a commit 130352f
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions scripts/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ aws ecr get-login-password \
echo "Building Docker image..."
docker build -t $AWS_ECR_REPOSITORY_NAME .

# Check if the ECR repository exists
# echo "Checking if ECR repository exists..."
# if aws ecr describe-repositories \
# --repository-names $AWS_ECR_REPOSITORY_NAME \
# --region $AWS_REGION > /dev/null 2>&1; then
# echo "ECR repository exists, deleting..."
# aws ecr delete-repository \
# --repository-name $AWS_ECR_REPOSITORY_NAME \
# --region $AWS_REGION \
# --force
# fi

# # Create the ECR repository
# echo "Creating ECR repository..."
# aws ecr create-repository \
# --repository-name $AWS_ECR_REPOSITORY_NAME \
# --region $AWS_REGION \
# --image-scanning-configuration scanOnPush=true \
# --image-tag-mutability MUTABLE \
# --no-cli-pager
Check if the ECR repository exists
echo "Checking if ECR repository exists..."
if aws ecr describe-repositories \
--repository-names $AWS_ECR_REPOSITORY_NAME \
--region $AWS_REGION > /dev/null 2>&1; then
echo "ECR repository exists, deleting..."
aws ecr delete-repository \
--repository-name $AWS_ECR_REPOSITORY_NAME \
--region $AWS_REGION \
--force
fi

# Create the ECR repository
echo "Creating ECR repository..."
aws ecr create-repository \
--repository-name $AWS_ECR_REPOSITORY_NAME \
--region $AWS_REGION \
--image-scanning-configuration scanOnPush=true \
--image-tag-mutability MUTABLE \
--no-cli-pager

# Tag the Docker image
echo "Tagging Docker image..."
Expand Down

0 comments on commit 130352f

Please sign in to comment.