-
Notifications
You must be signed in to change notification settings - Fork 16
/
Makefile
98 lines (64 loc) · 2.01 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
TAG := $(shell date +"%Y%m%d-%H%M%S")
REPO_ROOT := 387546586013.dkr.ecr.eu-west-1.amazonaws.com
REPO_URI := $(REPO_ROOT)/course-management
SITE_ID ?= 2
run: ## Run django server
run:
pipenv run python manage.py runserver 0.0.0.0:8000
migrations: ## Make migrations
migrations:
pipenv run python manage.py makemigrations
pipenv run python manage.py migrate
admin: ## Add an admin user
admin:
pipenv run python manage.py createsuperuser
user:
pipenv run python add_user.py
tests: ## Run tests
tests:
pipenv run python manage.py test courses.tests
data: ## Add data to database
data: migrations
pipenv run python add_data.py
test_data: data
pipenv run python add_more_test_data.py
shell: ## Run django shell
shell:
pipenv run python manage.py shell
tunnel_prod: ## Open tunnel to prod
bash tunnel-prod.sh
notebook: ## Run a jupyter notebook
notebook:
pipenv run jupyter notebook
docker_build: ## Build docker image
docker_build: tests
docker build -t course_management:$(TAG) .
docker_run: ## Run docker container
docker_run: docker_build
docker run -it --rm \
-p 8000:80 \
--name course_management \
-e SITE_ID="$(SITE_ID)" \
-e DEBUG="1" \
-e DATABASE_URL="sqlite:////data/db.sqlite3" \
-e VERSION=$(TAG) \
-v `cygpath -w ${PWD}/db`:/data \
course_management:$(TAG)
docker_bash: ## Run bash in docker container
docker_bash:
docker exec -it course_management bash
docker_auth: ## Authenticate to ECR
docker_auth:
aws ecr get-login-password --region eu-west-1 | docker login --username AWS --password-stdin $(REPO_ROOT)
docker_publish: ## Publish docker image to ECR
docker_publish: docker_build docker_auth
docker tag course_management:$(TAG) $(REPO_URI):$(TAG)
docker push $(REPO_URI):$(TAG)
deploy_dev: ## Deploy to dev environment
deploy_dev: docker_publish
bash deploy/deploy_dev.sh $(TAG)
deploy_prod: ## Deploy to prod environment
deploy_prod:
bash deploy/deploy_prod.sh
help: ## Show this help.
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e 's/\\$$//' | sed -e 's/##//'