-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
83 lines (68 loc) · 1.59 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
REGISTRY=ghcr.io/akundev
IMAGE_NAME=akundotdev
CONTAINER_NAME=akundotdev_container
VERSION=0.1.0
lint:
@echo "Running lint..."
pipenv run ruff check --fix -e .
pipenv run black .
pipenv run djlint . --reformat
ps:
@docker ps -a
build:
@echo "Building..."
docker build -t $(REGISTRY)/$(IMAGE_NAME):$(VERSION) .
docker tag $(REGISTRY)/$(IMAGE_NAME):$(VERSION) $(REGISTRY)/$(IMAGE_NAME):latest
push:
@echo "Pushing..."
docker push $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
docker push $(REGISTRY)/$(IMAGE_NAME):latest
run:
@echo "Running..."
docker run \
-it \
--rm \
-p 8000:8000 \
--name $(CONTAINER_NAME) \
-v $(PWD):/app \
--env-file .env \
--entrypoint python \
$(REGISTRY)/$(IMAGE_NAME):$(VERSION) manage.py runserver 0.0.0.0:8000
prod:
@echo "Running..."
docker run \
-it \
--rm \
-d \
-p 8000:8000 \
--name $(CONTAINER_NAME) \
--env-file .env \
$(REGISTRY)/$(IMAGE_NAME):$(VERSION)
make ps
stop:
@echo "Stopping..."
docker stop $(CONTAINER_NAME)
pull:
@echo "Pulling..."
docker pull $(REGISTRY)/$(IMAGE_NAME):$(VERSION)
logs:
@echo "Showing logs..."
docker logs $(CONTAINER_NAME) -f
manage:
@echo "Running manage.py..."
docker exec -it $(CONTAINER_NAME) python manage.py $(cmd)
test:
@echo "Running tests..."
make manage cmd="test"
migrate:
@echo "Running migrations..."
make manage cmd="migrate"
makemigrations:
@echo "Making migrations..."
make manage cmd="makemigrations"
createsuperuser:
@echo "Creating superuser..."
make manage cmd="createsuperuser"
collectstatic:
@echo "Collecting static files..."
make manage cmd="collectstatic --noinput"