forked from zabbix-tooling/zabbix-ldap-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (52 loc) · 1.86 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
SHELL = bash
IMAGE_REPO = scoopex666
IMAGE_NAME = zabbix-ldap-sync
TAG = dev
TAG_PUBLISH = $(shell git describe --abbrev=0 --tags)_$(shell date --date="today" "+%Y-%m-%d_%H-%M-%S")
FORCE_UPGRADE_MARKER ?= $(shell date "+%Y-%m-%d")
.PHONY: all deps clean prune
venv = . venv/bin/activate
## public
all: deps
deps: venv/bin/activate
run: deps
./zabbix-ldap-sync -f zabbix-ldap.conf
venv/bin/activate: Makefile
@which python3 > /dev/null || { echo "Missing requirement: python3" >&2; exit 1; }
virtualenv --version > /dev/null || { echo "Missing requirement: virtualenv -- aborting" >&2; exit 1; }
[ -e venv/bin/python ] || virtualenv -p $$(which python3) venv > /dev/null
${venv} && pip3 install -r requirements.txt
touch venv/bin/activate
clean:
rm -rf __pycache__
prune: clean
rm -rf venv
test: deps
${venv} && PYTHONPATH=zabbix-ldap-sync pytest
check: lint type-check
.PHONY: check
lint: deps
${venv} && python3 -m flake8 zabbix-ldap-sync lib
.PHONY: lint
type-check: deps
${venv} && python3 -m mypy zabbix-ldap-sync lib
.PHONY: lint
build:
docker build -t ${IMAGE_NAME}:${TAG} --build-arg FORCE_UPGRADE_MARKER="${FORCE_UPGRADE_MARKER}" -f Dockerfile .
@docker images ${IMAGE_NAME}:${TAG} --format='DockerImage Size: {{.Size}}'
.PHONY: build
clean_docker:
docker rmi ${IMAGE_NAME}:${TAG} || true
.PHONY: clean_docker
publish: clean_docker build
docker tag ${IMAGE_NAME}:${TAG} ${IMAGE_REPO}/${IMAGE_NAME}:${TAG_PUBLISH}
docker push ${IMAGE_REPO}/${IMAGE_NAME}:${TAG_PUBLISH}
docker tag ${IMAGE_NAME}:${TAG} ${IMAGE_REPO}/${IMAGE_NAME}:latest
docker push ${IMAGE_REPO}/${IMAGE_NAME}:latest
.PHONY: publish
dockertest: build
docker run --rm --name ${IMAGE_NAME} ${IMAGE_NAME}:${TAG} -f /zabbix-ldap-sync/zabbix-ldap.conf.example
.PHONY: dockertest
dockerinspect: build
docker run --rm --entrypoint /bin/bash --name ${IMAGE_NAME} -ti ${IMAGE_NAME}:${TAG}
.PHONY: inspect