-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuildspec.yml
More file actions
24 lines (22 loc) · 770 Bytes
/
buildspec.yml
File metadata and controls
24 lines (22 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
version: 0.1
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- echo -n "$CODEBUILD_BUILD_ID" | sed "s/.*:\([[:xdigit:]]\{7\}\).*/\1/" > /tmp/build_id.out
- printf "%s:%s" "$ECR_URI" "$(cat /tmp/build_id.out)" > /tmp/build_tag.out
- printf '{"tag":"%s"}' "$(cat /tmp/build_id.out)" > /tmp/build.json
- $(aws ecr get-login --region $ECR_REGION)
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build --tag "$(cat /tmp/build_tag.out)" .
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push "$(cat /tmp/build_tag.out)"
artifacts:
files: /tmp/build.json
discard-paths: yes