-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
55 lines (44 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
# Set make variables from .env file
ifneq (,$(wildcard ./.env))
include .env
export
ENV_FILE_PARAM = --env-file .env
endif
DOCKER_TAG ?= $(shell git rev-parse --short HEAD)
DOCKER_IMAGE ?= $(DOCKER_REGISTRY)/trovi:$(DOCKER_TAG)
DOCKER_IMAGE_LATEST ?= $(DOCKER_REGISTRY)/trovi:latest
DOCKER_DEV_IMAGE ?= trovi-dev:$(DOCKER_TAG)
DOCKER_DEV_IMAGE_LATEST ?= trovi-dev:latest
DOCKER_DIR ?= docker
PY_IMG_TAG ?= 3.9.7
.env:
cp .env.sample .env
.PHONY: build
build: .env
docker build --build-arg PY_IMG_TAG=$(PY_IMG_TAG) \
-t $(DOCKER_IMAGE) -f $(DOCKER_DIR)/Dockerfile --target release .
docker tag $(DOCKER_IMAGE) $(DOCKER_IMAGE_LATEST)
build-dev: .env
docker build --build-arg PY_IMG_TAG=$(PY_IMG_TAG) \
-t $(DOCKER_DEV_IMAGE) -f $(DOCKER_DIR)/Dockerfile --target dev .
docker tag $(DOCKER_DEV_IMAGE) $(DOCKER_DEV_IMAGE_LATEST)
.PHONY: publish
publish:
docker push $(DOCKER_IMAGE)
.PHONY: publish-latest
publish-latest:
docker push $(DOCKER_IMAGE_LATEST)
.PHONY: start
start: .env
docker-compose $(ENV_FILE_PARAM) up -d
.PHONY: clean
clean:
docker-compose $(ENV_FILE_PARAM) down
.PHONY: migrations
migrations: start
docker-compose exec trovi python manage.py makemigrations --check
requirements-frozen.txt: build
docker run --rm $(DOCKER_IMAGE) pip freeze > $@
.PHONY: tests
tests: .env
docker-compose -f ./tests-compose.yml run trovi test