-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
65 lines (43 loc) · 1.34 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
SECRETS_DIR=
DOCKER_REGISTRY=
ENV_D=shmatov
TAG=latest
-include .env
-include .env.local
.EXPORT_ALL_VARIABLES:
install-dev:
pipenv install --dev
install:
pipenv install
format:
black aoc_bot
isort aoc_bot
lint: format
flake8 aoc_bot
test:
pytest .
# Docker
docker-build:
docker build . -t aoc-telegram-bot:${TAG}
docker-bash:
docker run -ti --env-file=.env -v ${SECRETS_DIR}:/run/secrets aoc-telegram-bot:${TAG} bash
docker-run:
docker run -ti --env-file=.env -v ${SECRETS_DIR}:/run/secrets aoc-telegram-bot:${TAG}
docker-push:
docker tag aoc-telegram-bot:${TAG} ${DOCKER_REGISTRY}/aoc-telegram-bot:${TAG}
docker push ${DOCKER_REGISTRY}/aoc-telegram-bot:${TAG}
docker-all: docker-build docker-push
# Kubernetes
deploy-config-map:
kubectl delete cm/aoc-bot-${ENV_D} --ignore-not-found -n default
kubectl create cm aoc-bot-${ENV_D} --from-env-file=envs/${ENV_D}/.env
deploy-secret:
kubectl delete secret/aoc-bot-${ENV_D} --ignore-not-found -n default
kubectl create secret generic aoc-bot-${ENV_D} --from-file=${SECRETS_DIR}/aoc_bot__aoc_session_id --from-file=${SECRETS_DIR}/aoc_bot__telegram_token -n default
deploy-app:
kubectl apply -f envs/${ENV_D}/deployment.yaml -n default
restart-app:
kubectl rollout restart deploy/aoc-bot-${ENV_D}
deploy-all: deploy-config-map deploy-secret deploy-app
# Sync
all: docker-all deploy-all