forked from docker/docker-install
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
34 lines (27 loc) · 732 Bytes
/
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
TEST_IMAGE?=ubuntu:22.04
VERSION?=
CHANNEL?=
VOLUME_MOUNTS=-v "$(CURDIR)":/v
SHELLCHECK_EXCLUSIONS=$(addprefix -e, SC1091 SC1117 SC2317 SC2329)
SHELLCHECK=docker run --rm $(VOLUME_MOUNTS) -w /v koalaman/shellcheck:stable $(SHELLCHECK_EXCLUSIONS)
ENVSUBST_VARS=LOAD_SCRIPT_COMMIT_SHA
.PHONY: build
build: build/install.sh
build/install.sh: install.sh
mkdir -p $(@D)
LOAD_SCRIPT_COMMIT_SHA='$(shell git rev-parse HEAD)' envsubst '$(addprefix $$,$(ENVSUBST_VARS))' < $< > $@
.PHONY: shellcheck
shellcheck: build/install.sh
$(SHELLCHECK) $<
.PHONY: test
test: build/install.sh
docker run --rm -i \
$(VOLUME_MOUNTS) \
-w /v \
-e VERSION \
-e CHANNEL \
$(TEST_IMAGE) \
sh "$<"
.PHONY: clean
clean:
$(RM) -r build/