-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (38 loc) · 1.1 KB
/
Makefile
File metadata and controls
49 lines (38 loc) · 1.1 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
.PHONY: build test
NAME = web
VERSION = latest
REGISTRY = test
AWS_REPO_REGION = eu-west-2
build:
$(call blue, "Build Docker Image...")
docker build -t ${NAME}:${VERSION} .
test:
$(call blue, "Run unit tests...")
docker run --rm -it ${NAME}:${VERSION} sh -c "cd /app && .venv/bin/python manage.py test"
run:
$(call blue, "Start Application...")
docker-compose up --build
release: build test
$(call blue, "Release Docker Image...")
docker tag ${NAME}:latest ${NAME}:${VERSION}
login:
aws ecr get-login --no-include-email --region ${AWS_REPO_REGION}
publish:
$(call blue, "Publishing Docker Image to Registry...")
docker tag ${NAME}:${VERSION} ${REGISTRY}/${NAME}:${VERSION}
docker push ${REGISTRY}/${NAME}:${VERSION}
boot_debug:
$(call blue, "Prepare debug environment...")
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
run_debug: boot_debug
$(call blue, "Run application in debug mode localy...")
.venv/bin/python manage.py run
test_debug: boot_debug
$(call blue, "Run unit tests localy...")
.venv/bin/python manage.py test
define blue
@tput setaf 6
@echo $1
@tput sgr0
endef