forked from dinorows/twtr-jwt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buildspec.yml
37 lines (35 loc) · 1.21 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
36
37
version: 0.2
env:
variables:
AWS_REGION_2: "us-east-1"
REACT_APP_API_SERVICE_URL: "http://flask-react-alb-961735377.us-east-1.elb.amazonaws.com"
phases:
pre_build:
commands:
- echo logging into my dockerhub
- 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 dev images...
- echo docker-compose up -d --build
- echo building prod images...
- >
docker build \
-f be/Dockerfile \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/twtr-be:prod \
./be
- >
docker build \
-f fe/Dockerfile \
-t $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/twtr-fe:prod \
--build-arg NODE_ENV=production \
--build-arg REACT_APP_API_SERVICE_URL=$REACT_APP_API_SERVICE_URL \
./fe
post_build:
commands:
- echo pushing prod images to ecr...
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/twtr-be:prod
- docker push $AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/twtr-fe:prod