-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildspec.yml
33 lines (31 loc) · 1.22 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
version: 0.2
env:
variables:
AWS_REGION: "ap-northeast-1"
REACT_APP_API_SERVICE_URL: "http://todo-alb-1046995831.ap-northeast-1.elb.amazonaws.com"
phases:
pre_build:
commands:
- echo logging in to ecr
- >
aws ecr get-login-password --region $AWS_REGION \
- docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com
build:
commands:
- echo building images todo-app-backend, todo-app-frontend
- >
docker build \
-f project/backend/Dockerfile.prod \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/todo-app-backend:prod \
./project/backend
- >
docker build \
-f project/frontend/Dockerfile.prod \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/todo-app-frontend:prod \
--build-arg NODE_ENV=production \
--build-arg REACT_APP_API_SERVICE_URL=${REACT_APP_API_SERVICE_URL} \
./project/frontend
post_build:
commands:
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/todo-app-backend:prod
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/todo-app-frontend:prod