-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (42 loc) · 1.23 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
.DEFAULT_GOAL := run
ifdef PROD
TARGET := production
ENV_FILE := .env.prod
COMPOSE_ARGS := -f docker-compose.prod.yml --env-file .env.prod
else
TARGET := development
ENV_FILE := .env.dev
COMPOSE_ARGS := --env-file .env.dev
endif
USER_ID := $(shell id -u)
GROUP_ID := $(shell id -g)
.PHONY: run
run:
@echo "running for $(TARGET)"
sudo docker compose $(COMPOSE_ARGS) up
.PHONY: build
build: $(ENV_FILE)
@echo "building image(s) for $(TARGET)"
sudo docker compose $(COMPOSE_ARGS) build
$(ENV_FILE):
./generate_env.sh
.PHONY: install
install: dewolf build
@echo "installing for $(TARGET)"
test -d .venv || python -m venv .venv
. .venv/bin/activate; pip install -r requirements.txt
mkdir -p data/samples
touch data/db.sqlite3
sudo chown -R $(USER_ID):$(GROUP_ID) data/
sudo docker compose $(COMPOSE_ARGS) run web python manage.py makemigrations
sudo docker compose $(COMPOSE_ARGS) run web python manage.py migrate
# TODO shared volume permissions
sudo docker compose $(COMPOSE_ARGS) run --user 0 web python manage.py collectstatic
sudo chown -R $(USER_ID):$(GROUP_ID) data/
./install_worker_service.sh
.PHONY: dewolf
dewolf:
./update_dewolf.sh
.PHONY: filter
filter:
python filter.py -i data/samples.sqlite3 -o data/filtered.sqlite3