2021-09-30 13:15:26 +02:00
|
|
|
dcmd = docker
|
|
|
|
dfile = Dockerfile
|
|
|
|
dtag = immawanderer/archlinux:testbuild
|
|
|
|
dargs = build -t $(dtag) --no-cache --pull - < $(dfile)
|
|
|
|
cleanargs = image rm -f $(dtag)
|
|
|
|
pruneargs = system prune -af
|
2022-04-21 14:15:32 +02:00
|
|
|
dargskaniko = run --rm -it -w=$(kanikowdir) -v $$PWD:$(kanikowdir):z
|
2022-04-21 14:14:18 +02:00
|
|
|
kanikoexecutorimg = gcr.io/kaniko-project/executor:v1.8.1-debug
|
2021-09-30 13:15:26 +02:00
|
|
|
kanikowdir = /src
|
|
|
|
kanikocontext = .
|
2021-10-20 00:18:19 +02:00
|
|
|
kanikoargs = -f=$(dfile) -c=$(kanikocontext) --use-new-run --snapshotMode=redo --build-arg BUILD_DATE=$(build_date) --build-arg VCS_REF=$(vcs_ref) --no-push
|
|
|
|
vcs_ref = $$(git rev-parse --short HEAD)
|
|
|
|
build_date= $$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
2022-03-24 16:38:15 +01:00
|
|
|
hadolintimg = hadolint/hadolint
|
|
|
|
hadolinttag = v2.9.3-alpine
|
2022-04-21 14:18:16 +02:00
|
|
|
hadolintargs = run --rm -i -v $$PWD:/src:z --workdir=/src
|
2021-09-30 13:15:26 +02:00
|
|
|
.PHONY: hadolint build kaniko clean test prune
|
|
|
|
|
|
|
|
hadolint:
|
2022-03-24 16:38:15 +01:00
|
|
|
$(dcmd) $(hadolintargs) $(hadolintimg):$(hadolinttag) < $(dfile)
|
2021-09-30 13:15:26 +02:00
|
|
|
|
|
|
|
kaniko:
|
|
|
|
$(dcmd) $(dargskaniko) $(kanikoexecutorimg) $(kanikoargs)
|
|
|
|
|
|
|
|
build:
|
|
|
|
$(dcmd) $(dargs)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
$(dcmd) $(cleanargs)
|
|
|
|
|
|
|
|
test: hadolint build kaniko
|
|
|
|
|
|
|
|
prune:
|
|
|
|
$(dcmd) $(pruneargs)
|