-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
48 lines (42 loc) · 1.13 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
# EOL has comment to prevent erroneous whitespace in variables
IMAGE = zip#
DOCKER_HUB_USERNAME = joshkeegan#
IMAGE_URL = $(DOCKER_HUB_USERNAME)/$(IMAGE)#
.PHONY: clean
clean:
rm -r artefacts || true
mkdir artefacts
.PHONY: format
format:
@docker run --rm \
-v $(PWD):/check \
mstruebing/editorconfig-checker && \
echo "Editorconfig styles followed"
# Args
# - params: optional. Additional params to pass to buildx
.PHONY: build
build: clean get-version-number
docker buildx build \
--platform linux/amd64,linux/arm/v7,linux/arm64 \
--no-cache \
--pull $(params) \
-t $(IMAGE_URL):`cat artefacts/version`\
-t $(IMAGE_URL):latest \
.
.PHONY: get-version-number
get-version-number:
# Get the version number from the version of the base image
# e.g. a base of alpine:3.12.0 would have version number 3.12.0
export MSYS_NO_PATHCONV=1 && \
docker run \
--rm \
-v ${PWD}:/app:ro \
jess/dockfmt:v0.3.3 \
base \
/app/Dockerfile \
| awk 'NR > 1 { split($$1, a, ":"); split(a[2], b, "-"); printf "%s", b[1] }' \
> artefacts/version
echo `cat artefacts/version`
.PHONY: publish
publish: params=--push
publish: build