-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
37 lines (27 loc) · 1.01 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_BUILD = docker build --build-arg GIT_DESCRIBE_STRING=$$GIT_DESCRIBE_STRING -t $@ .
GIT_DESC_CMD = git describe --tags --long --dirty --match "*.*" 2>/dev/null || echo ''
# Module name, it must be the same name as the module command and a valid Docker name
MODULE_NAME = yellowgreen-multi
.PHONY: all build check module_name $(MODULE_NAME)
all: build check
# Build the production module
build: $(MODULE_NAME)
# Echo the module (repository) name
module_name:
@echo $(MODULE_NAME)
# Echo the module version from the built Docker image
module_version:
@docker run --rm $(MODULE_NAME) --version | sed 's/.* v//;s/+/-/'
# Define the module target
# Fallback to the null version if there was no Git tag
$(MODULE_NAME):
@GIT_DESCRIBE_STRING=`$(GIT_DESC_CMD)` \
&& echo "$(DOCKER_BUILD)" \
&& $(DOCKER_BUILD)
# Rapid integrity check to make sure everything is correctly installed
check:
docker run --rm --entrypoint bash $(MODULE_NAME) -c "\
. /app/venv/bin/activate \
&& $(MODULE_NAME) --version \
&& exit \
"