-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yaml
31 lines (31 loc) · 1.35 KB
/
buildspec.yaml
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
version: 0.2
phases:
install:
runtime-versions:
nodejs: 18
pre_build:
commands:
- echo Logging in to Amazon ECR...
- aws --version
- DOCKER_PASSWORD=$(aws ecr get-login-password --region eu-north-1)
- echo $DOCKER_PASSWORD
- $(sudo docker login -u AWS --password $DOCKER_PASSWORD "https://$(aws sts get-caller-identity --query 'Account' --output text).dkr.ecr.eu-north-1.amazonaws.com")
- REPOSITORY_URI=200506703857.dkr.ecr.eu-north-1.amazonaws.com/pokerplanning
- COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7)
- API_IMAGE_TAG=api-${COMMIT_HASH:=latest}
- CLIENT_IMAGE_TAG=client-${COMMIT_HASH:=latest}
build:
commands:
- echo Build started on `date`
- echo Building the Docker image...git gu
- docker build -t $REPOSITORY_URI:api-latest ./api
- docker build -t $REPOSITORY_URI:client-latest ./client
- docker tag $REPOSITORY_URI:api-latest $REPOSITORY_URI:$API_IMAGE_TAG
- docker tag $REPOSITORY_URI:client-latest $REPOSITORY_URI:$CLIENT_IMAGE_TAG
post_build:
commands:
- echo Build completed on `date`
- echo Pushing the Docker images...
- docker push $REPOSITORY_URI:$CLIENT_IMAGE_TAG
- docker push $REPOSITORY_URI:$API_IMAGE_TAG
- echo Writing image definitions file...