forked from gtramontina/docker-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (28 loc) · 777 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
35
36
37
38
39
SHELL := bash -eu -o pipefail -c
.DELETE_ON_ERROR:
# ---
image-name := gtramontina/diagrams
tag = $(shell cat pyproject.toml | grep -e "^diagrams =" | awk -F '"' '{print $$2}')
# ---
build.log: pyproject.toml Dockerfile Makefile
@docker build -t $(image-name):$(tag) . | tee $@
to-clobber += $(image-name):$(tag)
to-clean += build.log
test.log: build.log
@(cat sample.py | docker run -v $(PWD)/out:/out -i --rm $(image-name):$(tag)) &&\
(file out/sample.png | grep "PNG image data") | tee $@
to-clean += test.log
to-clean += ./out
# ---
.PHONY: build
build: build.log
.PHONY: test
test: test.log
.PHONY: push
push: test
@docker push $(image-name):$(tag)
.PHONY: clean
clean:; @rm -rf $(to-clean)
.PHONY: clobber
clobber: clean
@docker rmi $(to-clobber) --force