mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 07:01:56 +03:00
084c9d1367
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,
23 lines
1012 B
YAML
23 lines
1012 B
YAML
version: 0.2
|
|
|
|
phases:
|
|
pre_build:
|
|
commands:
|
|
- $(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 .
|
|
post_build:
|
|
commands:
|
|
# push
|
|
- docker tag $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest
|
|
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:$CODEBUILD_RESOLVED_SOURCE_VERSION
|
|
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com/$IMAGE_REPO_NAME:latest
|
|
# create new task definition
|
|
- ./create-new-task-def.sh $IMAGE_REPO_NAME
|
|
|
|
artifacts:
|
|
files:
|
|
- 'appspec.yaml'
|
|
- 'taskdef.json'
|