This repository has been archived by the owner on Nov 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildspec.yml
30 lines (29 loc) · 1.5 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
29
30
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
- REPOSITORY_URI=699011322781.dkr.ecr.us-east-2.amazonaws.com/pipepay-dev
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- echo $PRIVATE_KEY > ./src/api/modules/private_key.txt
- docker build --build-arg PORT=$PORT --build-arg PAYSTACK_SECRET=$PAYSTACK_SECRET --build-arg PAYSTACK_PUBLIC_KEY=$PAYSTACK_PUBLIC_KEY --build-arg COGNITO_AUD=$COGNITO_AUD --build-arg COGNITO_USER_POOL_ID=$COGNITO_USER_POOL_ID --build-arg DB_HOST=$DB_HOST --build-arg DB_USER=$DB_USER --build-arg DB_PASSWORD=$DB_PASSWORD --build-arg JWT_SECRET=$JWT_SECRET --build-arg ACCESS_KEY_ID=$ACCESS_KEY_ID --build-arg SECRET_KEY=$SECRET_KEY --build-arg MAILER_CLIENT_ID=$MAILER_CLIENT_ID -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:latest
- docker push $REPOSITORY_URI:$IMAGE_TAG
- printf '[{"name":"pipepay", "imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json