-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
35 lines (32 loc) · 1.32 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
33
34
35
version: 0.2
env:
variables:
APP_NAME: "angular-rebloc"
phases:
pre_build:
commands:
- echo pre_build started...
- IMAGE_TAG=${CODEBUILD_BUILD_NUMBER}
- echo $IMAGE_TAG
- echo $AWS_DEFAULT_REGION
- echo $AWS_ACCOUNT_ID
- echo $REPOSITORY_URI
- echo logging into amzon ecr...
- aws ecr get-login-password --region $AWS_DEFAULT_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_DEFAULT_REGION.amazonaws.com
- echo login successful
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...
- docker build --build-arg HOST_ENV=${HOST_ENVIRONMENT} -t $REPOSITORY_URI:latest .
- echo Build Docker image successful...
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG
- docker push $REPOSITORY_URI:$IMAGE_TAG
- echo Finished pushing the Docker images...
- printf '[{"name":"angular-rebloc","imageUri":"%s"}]' $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json
artifacts:
files: imagedefinitions.json