Update buildspec.yml for new AWS CLI ECR login

Hi Edward,

The ECR login method in this code is deprecated (https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login.html). 
To login to ECR you need to use what is in the documentation here: https://docs.aws.amazon.com/cli/latest/reference/ecr/get-login-password.html
I refactored the login command using the new command in the link above.

Thank you,
This commit is contained in:
Refayat Haque
2021-01-25 20:34:17 -05:00
committed by GitHub
parent 4660281bd5
commit 084c9d1367
+1 -1
View File
@@ -3,7 +3,7 @@ version: 0.2
phases:
pre_build:
commands:
- $(aws ecr get-login --no-include-email)
- $(aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com)
build:
commands:
- docker build -t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION .