-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
25 lines (23 loc) · 1.31 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
version: 0.2
phases:
pre_build:
commands:
- echo Logging to Amazon ECR
- aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 294380780117.dkr.ecr.us-east-1.amazonaws.com
- REPOSITORY_URI=294380780117.dkr.ecr.us-east-1.amazonaws.com/devils
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
build:
commands:
- echo Building the Docker image
- docker build --build-arg NODE_ENV=${NODE_ENV} --build-arg DB_USER=${DB_USER} --build-arg DB_PASSWORD=${DB_PASSWORD} --build-arg DB_HOST=${DB_HOST} --build-arg DB_HOST_UAT=${DB_HOST_UAT} --build-arg DB_DATABASE=${DB_DATABASE} --build-arg PORT=${PORT} --build-arg JWT_SECRET=${JWT_SECRET} --build-arg DB_DATABASE=${DB_DATABASE} --build-arg JWT_EXPIRES_IN=${JWT_EXPIRES_IN} --build-arg SENDGRID_API_KEY=${SENDGRID_API_KEY} --build-arg SENDER_EMAIL=${SENDER_EMAIL} -t $REPOSITORY_URI:$COMMIT_HASH .
post_build:
commands:
- echo Build completed
- echo Pushing the Docker image
- docker push $REPOSITORY_URI:$COMMIT_HASH
- echo Writing image definition files
- printf '[{"name":"devils-task","imageUri":"%s"}]' $REPOSITORY_URI:$COMMIT_HASH > imagedefinitions.json
- cat imagedefinitions.json
artifacts:
files:
- imagedefinitions.json