This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (55 loc) · 1.57 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
# Project variables
PROJECT_NAME=queryfi
PROJECT_VERSION=0.1.0
# Docker variables
DOCKER_REGISTRY=
DOCKER_REPOSITORY=$(PROJECT_NAME)
DOCKER_IMAGE=$(DOCKER_REGISTRY)$(DOCKER_REPOSITORY):$(PROJECT_VERSION)
DOCKER_BUILD_CONTEXT=.
DOCKER_BUILD_TARGET=development
DOCKER_COMPOSE_FILE=docker-compose.yml
.PHONY: help
help:
@echo "Usage: make [command]"
@echo ""
@echo "Available commands:"
@echo " setup Setup development environment"
@echo " clean Clean up development environment"
@echo " format Format code using black"
@echo " lint Lint code using flake8"
@echo " build Build Docker image"
@echo " push Push Docker image to registry"
@echo " run Run Docker container using Docker Compose"
@echo " stop Stop Docker container using Docker Compose"
@echo ""
.PHONY: setup
setup:
pip install -r requirements-dev.txt
.PHONY: clean
clean:
find . -type d -name "__pycache__" -exec rm -rf {} \;
find . -type f -name "*.pyc" -exec rm -f {} \;
.PHONY: format
format:
black app tests
.PHONY: lint
lint:
flake8 app tests
.PHONY: build
build:
docker build \
-t $(DOCKER_IMAGE) \
-f Dockerfile \
--target $(DOCKER_BUILD_TARGET) \
--build-arg VERSION=$(PROJECT_VERSION) \
--build-arg APP_HOME=/app \
$(DOCKER_BUILD_CONTEXT)
.PHONY: push
push:
docker push $(DOCKER_IMAGE)
.PHONY: run
run:
docker-compose -f $(DOCKER_COMPOSE_FILE) up -d
.PHONY: stop
stop:
docker-compose -f $(DOCKER_COMPOSE_FILE) down