-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (39 loc) · 1.29 KB
/
Makefile
File metadata and controls
57 lines (39 loc) · 1.29 KB
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
all: graph hadolint mypy README.md
# Output per target, use bash in recipes, fail on errors, be quiet by default
MAKEFLAGS := -rRO
SHELL := $(shell command -v bash)
.SHELLFLAGS := -eEo pipefail -c
.ONESHELL:
$(V).SILENT:
.PHONY: all clean docker graph hadolint mypy
# Update README.md
actions := none attach detach snapshot clean list
.INTERMEDIATE: $(actions:%=README.md.%)
$(actions:%=README.md.%): README.md.%:
COLUMNS=110 ./vol $(*:none=) -h >"$@"
README.md: $(actions:%=README.md.%) vol $(MAKEFILE_LIST)
end='^%$$'
$(foreach action,$(actions),beg='^% vol $(action:none=)* -h$$'; sed -e "/$$beg/,/$$end/{ /$$beg/{p; r README.md.$(action)
}; /$$end/p; d }" -i "$@";)
clean:
rm -f $(actions:%=README.md.%)
# Run mypy
mypy-venv: requirements.txt $(MAKEFILE_LIST)
python3 -m venv mypy-venv
source mypy-venv/bin/activate
pip -q install -r requirements.txt
pip -q install boto3 'boto3-stubs[essential]' mypy types-python-dateutil
mypy: mypy-venv
source mypy-venv/bin/activate
mypy vol
# Run hadolint
hadolint:
hadolint Dockerfile
# Build the docker image
docker: hadolint
maybe_sudo="$$(id -nG|grep -qw docker && echo || echo sudo)"
$$maybe_sudo docker buildx build -t vol .
# Generate the graph for the README
graph: vol-attach.svg
vol-attach.svg: vol-attach.dot
dot -Tsvg "$<" -o "$@"