-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
24 lines (20 loc) · 885 Bytes
/
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
version: 0.2
phases:
pre_build:
commands:
- export CONTAINER_REPOSITORY_URL=$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/llm-backend-app
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- IMAGE_TAG=${COMMIT_HASH:=latest}
- echo Logging in to Amazon ECR...
- aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com
build:
on-failure: ABORT
commands:
- echo Start building docker image on `date`
- docker build -t $CONTAINER_REPOSITORY_URL:$IMAGE_TAG -f Dockerfile-prod .
- docker tag $CONTAINER_REPOSITORY_URL:$IMAGE_TAG $CONTAINER_REPOSITORY_URL:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $CONTAINER_REPOSITORY_URL:$IMAGE_TAG