-
Notifications
You must be signed in to change notification settings - Fork 19
/
buildspec.yml
28 lines (27 loc) · 1.37 KB
/
buildspec.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
version: 0.2
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- REPOSITORY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com/${IMAGE_NAME}
- REGISTORY_URI=${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_DEFAULT_REGION}.amazonaws.com
- aws ecr get-login-password | docker login --username AWS --password-stdin ${REGISTORY_URI}
- IMAGE_TAG=$(echo ${CODEBUILD_RESOLVED_SOURCE_VERSION} | cut -c 1-7)
build:
commands:
- echo Build start `date`
- echo Build Docker
- echo ${REPOSITORY_URI}
- docker build --build-arg APIKEY=${APIKEY} --build-arg AUTHDOMAIN=${AUTHDOMAIN} --build-arg DATABASEURL=${DATABASEURL} --build-arg PROJECTID=${PROJECTID} --build-arg STORAGEBUCKET=${STORAGEBUCKET} --build-arg MESSAGINGSENDERID=${MESSAGINGSENDERID} --build-arg APPID=${APPID} --build-arg MEASUREMENTID=${MEASUREMENTID} -t ${REPOSITORY_URI}:latest .
- docker tag ${REPOSITORY_URI}:latest ${REPOSITORY_URI}:${IMAGE_TAG}
post_build:
commands:
- echo Build complete `date`
- echo Push Docker
- docker push ${REPOSITORY_URI}:latest
- docker push ${REPOSITORY_URI}:${IMAGE_TAG}
- echo Writing image definitions file...
- echo "[{\"name\":\"${CONTAINER_NAME}\",\"imageUri\":\"${REPOSITORY_URI}:${IMAGE_TAG}\"}]" > imagedefinitions.json
artifacts:
files: imagedefinitions.json