diff --git a/Makefile b/Makefile index cfe0555dca47ef3f288be0b17379a72da0b9f7d4..9ef41ea5a86f7b4f0a1a20e52f635491c0396515 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ .DEFAULT_GOAL := help +REGISTRY_HOST := quay.io + include utils/*.mk .PHONY: check-machine diff --git a/images/.utils/container-build.mk b/images/.utils/container-build.mk index 9c437f025b3bb511b6c8fafa9aa7174b8415a722..520df59c25580e9ac9638dc72da0bd167921446e 100644 --- a/images/.utils/container-build.mk +++ b/images/.utils/container-build.mk @@ -1,5 +1,6 @@ # # Copyright 2015 Xebia Nederland B.V. +# Copyright 2022 Christoph (Sheogorath) Kern # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -14,7 +15,7 @@ # limitations under the License. # REGISTRY_HOST=docker.io -USERNAME=$(USER) +USERNAME=$(shell podman login --get-login $(REGISTRY_HOST)) NAME=$(shell basename $(CURDIR)) RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support @@ -48,15 +49,8 @@ post-push: docker-build: .release podman build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH) - @DOCKER_MAJOR=$(shell podman -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f1) ; \ - DOCKER_MINOR=$(shell podman -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \ - if [ $$DOCKER_MAJOR -eq 1 ] && [ $$DOCKER_MINOR -lt 10 ] ; then \ - echo podman tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\ - podman tag -f $(IMAGE):$(VERSION) $(IMAGE):latest ;\ - else \ - echo podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\ - podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \ - fi + echo podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\ + podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \ .release: @echo "release=0.0.0" > .release @@ -68,9 +62,9 @@ docker-build: .release release: check-status check-release build push -push: pre-push do-push post-push +push: pre-push do-push post-push -do-push: +do-push: podman push $(IMAGE):$(VERSION) podman push $(IMAGE):latest @@ -80,13 +74,13 @@ showver: .release @. $(RELEASE_SUPPORT); getVersion tag-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel) -tag-patch-release: .release tag +tag-patch-release: .release tag tag-minor-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMinorLevel) -tag-minor-release: .release tag +tag-minor-release: .release tag tag-major-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel) -tag-major-release: .release tag +tag-major-release: .release tag patch-release: tag-patch-release release @echo $(VERSION) diff --git a/images/demo/Makefile b/images/demo/Makefile index 7b29fd87bdcb1fedd4d2ee7198986f74ea50c2a3..0869882fc9196ab6ed616ae0b61e295268d7563e 100644 --- a/images/demo/Makefile +++ b/images/demo/Makefile @@ -1,7 +1,5 @@ include ../.utils/container-build.mk -USERNAME=shivering-isles - pre-build: @echo do some stuff before the docker build diff --git a/utils/images.mk b/utils/images.mk new file mode 100644 index 0000000000000000000000000000000000000000..cd52e07f41fd5a248f090556125da35cb1fc7487 --- /dev/null +++ b/utils/images.mk @@ -0,0 +1,8 @@ +IMG_DIRS := $(wildcard images/*) + +.PHONY: $(IMG_DIRS) +$(IMG_DIRS): + $(MAKE) -C $@ snapshot REGISTRY_HOST=$(REGISTRY_HOST) USERNAME=$(USERNAME) + +.PHONY: images +images: $(IMG_DIRS) ## Build all local images