-
Notifications
You must be signed in to change notification settings - Fork 1
/
project.mk
56 lines (49 loc) · 1.95 KB
/
project.mk
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
MAKEFLAGS += --always-make
SHELL = /bin/sh
.SUFFIXES:
container_tool ?= podman
hadolint_version ?= latest
upstream ?= https://github.com/metio/devcontainers
repository ?= metio
build-image = $(container_tool) build \
--tag $(repository)/$(1):$(2) \
--label org.opencontainers.image.title="$(1)" \
--label org.opencontainers.image.description="Image for $(1) development" \
--label org.opencontainers.image.licenses="0BSD" \
--label org.opencontainers.image.vendor="metio.wtf" \
--label org.opencontainers.image.url="$(upstream)" \
--label org.opencontainers.image.documentation="$(upstream)" \
--label org.opencontainers.image.source="$(upstream)/languages/$(1)/$(2)" \
--label org.opencontainers.image.version="$(2)" \
--label org.opencontainers.image.revision="$(shell git rev-parse HEAD)" \
--label org.opencontainers.image.created="$(shell date --rfc-3339=seconds)" \
--file Containerfile \
./languages/$(1)/$(2)
hadolint = $(container_tool) run \
--rm \
--interactive \
--env HADOLINT_IGNORE=DL3059,DL3007 \
docker.io/hadolint/hadolint:$(hadolint_version) < ./languages/$(1)/$(2)/Containerfile
dockerfilelint = $(container_tool) run \
--rm \
--interactive \
docker.io/replicated/dockerfilelint < ./languages/$(1)/$(2)/Containerfile
-include generated.mk
generated.mk: project.mk
@for lld in languages/*; do \
lang=$$(basename "$${lld}"); \
for vld in languages/"$${lang}"/*; do \
version=$$(basename "$${vld}"); \
if [ -f "$${vld}/Containerfile" ]; then \
echo "$${lang}-$${version}-build:"; \
printf '\t$$(call build-image,%s,%s)\n' "$${lang}" "$${version}"; \
echo "$${lang}-$${version}-lint:"; \
printf '\t$$(call hadolint,%s,%s)\n' "$${lang}" "$${version}"; \
echo ;\
fi ;\
done ;\
done > $@
list: ## List all images
$(container_tool) image list --filter reference=metio
clean: ## Cleanup dangling images
$(container_tool) system prune --force