-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
30 lines (28 loc) · 1.02 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
version: 0.2
env:
parameter-store:
build_ssh_key: "/Dev/Production/chatbox-nlp-api/codebuild_ssh_key"
phases:
install:
commands:
- export DEPLOY_SCRIPT=/home/ec2-user/server/prod.sh
- mkdir -p ~/.ssh
- echo "$build_ssh_key" > ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa
pre_build:
commands:
- echo Logging into aws public ECR...
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin $IMAGE_REGISTRY
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build -t $IMAGE_REPO_NAME:$IMAGE_TAG .
- docker tag $IMAGE_REPO_NAME:$IMAGE_TAG $IMAGE_REGISTRY/$IMAGE_REPO_NAME:$IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker image...
- docker push $IMAGE_REGISTRY/$IMAGE_REPO_NAME:$IMAGE_TAG
# - echo Deploying the Docker image...
# - ssh -o "StrictHostKeyChecking no" $SERVER_URL $DEPLOY_SCRIPT