-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
32 lines (29 loc) · 1.16 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
31
32
version: 0.2
env:
secrets-manager:
OPENAI_API_KEY: "arn:aws:secretsmanager:us-east-2:449750766897:secret:openai-key-hQVA2G"
phases:
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 449750766897.dkr.ecr.us-east-2.amazonaws.com
- REPOSITORY_URI=449750766897.dkr.ecr.us-east-2.amazonaws.com/pucrs-fullstack
- IMAGE_TAG=${REPOSITORY_URI}:${CODEBUILD_RESOLVED_SOURCE_VERSION}
- OPENAI_API_KEY=$(echo $OPENAI_API_KEY | jq -r '.OPENAI_API_KEY')
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build --build-arg OPENAI_API_KEY=$OPENAI_API_KEY -t $REPOSITORY_URI:latest .
- docker tag $REPOSITORY_URI:latest $IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image to ECR...
- docker push $REPOSITORY_URI:latest
- docker push $IMAGE_TAG
- printf '[{"name":"pucrs-fullstack","imageUri":"%s"}]' $IMAGE_TAG > imagedefinitions.json
artifacts:
files:
- imagedefinitions.json