-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuildspec.yml
More file actions
20 lines (20 loc) · 759 Bytes
/
buildspec.yml
File metadata and controls
20 lines (20 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- export AWS_REGION=$(echo $ECR_REPOSITORY_URL | cut -d '.' -f 4)
- aws ecr get-login-password | docker login --username AWS --password-stdin $ECR_REPOSITORY_URL
- IMAGE_TAG=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
build:
commands:
- docker build -t $ECR_REPOSITORY_URL:$IMAGE_TAG .
- docker tag $ECR_REPOSITORY_URL:$IMAGE_TAG $ECR_REPOSITORY_URL:latest
- docker push $ECR_REPOSITORY_URL:latest
- docker push $ECR_REPOSITORY_URL:$IMAGE_TAG
post_build:
commands:
- printf '[{"name":"web","imageUri":"%s"}]' $ECR_REPOSITORY_URL:$IMAGE_TAG > imagespec.json
artifacts:
files:
- imagespec.json