-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec_build-push.yml
19 lines (18 loc) · 1.24 KB
/
buildspec_build-push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to ECR...
- aws ecr get-login-password --region ap-northeast-2 | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com
- aws ecr get-login-password --region ap-northeast-1 | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-1.amazonaws.com
build:
commands:
- echo Building the container image...
- docker build -t $IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION .
- docker tag $IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/$IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION
- docker tag $IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-1.amazonaws.com/$IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION
post_build:
commands:
- echo Pushing the container image...
- docker push $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-2.amazonaws.com/$IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION
- docker push $AWS_ACCOUNT_ID.dkr.ecr.ap-northeast-1.amazonaws.com/$IMAGE_REPO_NAME:commit-$CODEBUILD_RESOLVED_SOURCE_VERSION