-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
62 lines (48 loc) · 2.09 KB
/
Copy pathmakefile
File metadata and controls
62 lines (48 loc) · 2.09 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
export REGION := ap-southeast-2
export ECR_REPO_URL := 533545012068.dkr.ecr.ap-southeast-2.amazonaws.com
export BRANCH_NAME :=$(shell git branch --show-current)
export API_HOST := https://wallet.trackback.dev
export NODE_END_POINT := wss://blockchain.trackback.dev/
export IP_WEB :=$(shell cd terraform/ap-southeast-2 && terraform output -json | jq .info.value.aws_instance_wallet_web )
all:
docker-compose -f ./docker-compose-local.yml up --build --force-recreate --remove-orphans
run: ecr-login
docker-compose up --build --force-recreate --remove-orphans -d
redeploy: ecr-login clean run
stop:
docker-compose stop -t 1
ecr-login:
aws ecr get-login-password \
--region ${REGION} \
| docker login \
--username AWS \
--password-stdin ${ECR_REPO_URL}
ecr: ecr-login
-aws ecr create-repository --repository-name wallet-api || true
-aws ecr create-repository --repository-name wallet || true
-aws ecr create-repository --repository-name wallet-nginx || true
build-api:
cd wallet-api && docker build -f ./Dockerfile --no-cache -t wallet-api:latest .
docker tag wallet-api:latest $(ECR_REPO_URL)/wallet-api:latest
docker push $(ECR_REPO_URL)/wallet-api:latest
build-wallet:
cd wallet && docker build -f ./Dockerfile --no-cache -t wallet:latest .
docker tag wallet:latest $(ECR_REPO_URL)/wallet:latest
docker push $(ECR_REPO_URL)/wallet:latest
build-nginx:
cd nginx && docker build -f ./Dockerfile --no-cache -t wallet-nginx:latest .
docker tag wallet-nginx:latest $(ECR_REPO_URL)/wallet-nginx:latest
docker push $(ECR_REPO_URL)/wallet-nginx:latest
build: build-api build-wallet build-nginx
down:
docker-compose -f ./docker-compose-local.yml stop -t 1
clean:
docker-compose stop -t 1
docker-compose rm -f
docker rmi -f $(shell docker images -q)
destroy:
cd terraform/ap-southeast-2 && terraform destroy -var="branch_name=$(BRANCH_NAME)" --auto-approve
deploy: destroy
cd terraform/ap-southeast-2 && terraform apply -var="branch_name=$(BRANCH_NAME)" --auto-approve
remotedeploy: ecr-login build
ssh -i ~/.ssh/ec2_key.pem ubuntu@$(IP_WEB) -t 'cd wallet-demo && make redeploy'