-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
80 lines (64 loc) · 1.78 KB
/
Makefile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
EC2_USER=ec2-user
EC2_IP=3.26.190.206
KEY_PATH=mrluas.pem
CONTAINER=bot
DEVCONTAINER=bot-dev
.PHONY: build
build:
docker build -t telegram-airdop-bot .
.PHONY: up
up:
docker compose up --remove-orphans
.PHONY: down
down:
docker compose down
.PHONY: destroy
destroy:
docker compose down --volumes --rmi all
.PHONY: shell
shell:
docker compose run $(CONTAINER) sh
.PHONY: log
log:
docker compose logs -f $(CONTAINER)
.PHONY: safe
safe:
@if [ -z "$(app)" ]; then \
echo "Error: Please choose correct app."; \
exit 1; \
fi
@mv api_data/$(app)/api_data.new.json api_data/$(app)/api_data.json
.PHONE: env
env:
export $(cat .env | xargs)
.PHONY: deploy
EC2_USER=ec2-user
EC2_IP=3.25.135.123
KEY_PATH=../mrluas.pem
deploy:
@docker save -o telegram-airdop-bot.tar telegram-airdop-bot:latest \
&& scp -i $(KEY_PATH) telegram-airdop-bot.tar $(EC2_USER)@$(EC2_IP):~/images/telegram-airdop-bot.tar \
&& scp -i $(KEY_PATH) compose.yaml $(EC2_USER)@$(EC2_IP):~/images/compose.yaml \
&& ssh -i $(KEY_PATH) $(EC2_USER)@$(EC2_IP) 'docker stop telegram-airdop-bot || true && docker rm telegram-airdop-bot || true && docker load -i ~/images/telegram-airdop-bot.tar && cd images && docker-compose up -d'
.PHONY: ssh
ssh:
ssh -i $(KEY_PATH) $(EC2_USER)@$(EC2_IP)
# Local run
.PHONY: build-dev
build-dev:
docker compose -f docker/compose.dev.yaml build
.PHONY: run-dev
run-dev:
docker compose -f docker/compose.dev.yaml exec $(DEVCONTAINER) python3 main.py
.PHONY: start-dev
start-dev:
docker compose -f docker/compose.dev.yaml up -d
.PHONY: shell-dev
shell-dev:
docker compose -f docker/compose.dev.yaml exec $(DEVCONTAINER) sh
.PHONY: stop-dev
stop-dev:
docker compose -f docker/compose.dev.yaml down
.PHONY: destroy-dev
destroy-dev:
docker compose -f docker/compose.dev.yaml down --volumes --rmi all