-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
37 lines (26 loc) · 1.29 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
DOCKER := docker
CURRENT_DIR := $(shell pwd)
IMAGE_NAME := healthcheckbot
.PHONY:
check_env:
ifeq ("$(wildcard .env)","")
cp env.sample .env
endif
run: check_env build
@$(DOCKER) run --name $(IMAGE_NAME) --restart on-failure:3 --env-file .env -v $(CURRENT_DIR):/opt/app --add-host=host.docker.internal:host-gateway $(IMAGE_NAME):latest
run_detached: check_env build
@$(DOCKER) run -d --name $(IMAGE_NAME) --restart always --env-file .env -v $(CURRENT_DIR):/opt/app --add-host=host.docker.internal:host-gateway -ti $(IMAGE_NAME):latest
run_dev: check_env build_dev
@$(DOCKER) run --rm --env-file .env -v $(CURRENT_DIR):/opt/app --add-host=host.docker.internal:host-gateway -ti $(IMAGE_NAME):latest
build:
@$(DOCKER) build . -t $(IMAGE_NAME):latest
build_dev: check_env
@$(DOCKER) build --build-arg requirements=dev . -t $(IMAGE_NAME):latest
bash: check_env build_dev
@$(DOCKER) run --rm --env-file .env -v $(CURRENT_DIR):/opt/app -ti $(IMAGE_NAME):latest bash
lint: check_env build_dev
@$(DOCKER) run --rm --env-file .env $(IMAGE_NAME):latest flake8 .
test: check_env build_dev
@$(DOCKER) run --rm --env-file .env $(IMAGE_NAME):latest python -m pytest .
coverage: check_env build_dev
@$(DOCKER) run --rm --env-file .env -v $(CURRENT_DIR):/opt/app $(IMAGE_NAME):latest python -m pytest --cov-report html