Skip to content
Snippets Groups Projects
Verified Commit 32777630 authored by Sheogorath's avatar Sheogorath :european_castle:
Browse files

feat(Makefile): Add universal container build CLI

This patch adds some basic build instructions for the container image
build infrastructure.
parent 0887bf3d
No related branches found
No related tags found
No related merge requests found
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
REGISTRY_HOST := quay.io
include utils/*.mk include utils/*.mk
.PHONY: check-machine .PHONY: check-machine
......
# #
# Copyright 2015 Xebia Nederland B.V. # Copyright 2015 Xebia Nederland B.V.
# Copyright 2022 Christoph (Sheogorath) Kern
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
...@@ -14,7 +15,7 @@ ...@@ -14,7 +15,7 @@
# limitations under the License. # limitations under the License.
# #
REGISTRY_HOST=docker.io REGISTRY_HOST=docker.io
USERNAME=$(USER) USERNAME=$(shell podman login --get-login $(REGISTRY_HOST))
NAME=$(shell basename $(CURDIR)) NAME=$(shell basename $(CURDIR))
RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support RELEASE_SUPPORT := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))/.make-release-support
...@@ -48,15 +49,8 @@ post-push: ...@@ -48,15 +49,8 @@ post-push:
docker-build: .release docker-build: .release
podman build $(DOCKER_BUILD_ARGS) -t $(IMAGE):$(VERSION) $(DOCKER_BUILD_CONTEXT) -f $(DOCKER_FILE_PATH) 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) ; \ echo podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ;\
DOCKER_MINOR=$(shell podman -v | sed -e 's/.*version //' -e 's/,.*//' | cut -d\. -f2) ; \ podman tag $(IMAGE):$(VERSION) $(IMAGE):latest ; \
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
.release: .release:
@echo "release=0.0.0" > .release @echo "release=0.0.0" > .release
...@@ -68,9 +62,9 @@ docker-build: .release ...@@ -68,9 +62,9 @@ docker-build: .release
release: check-status check-release build push 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):$(VERSION)
podman push $(IMAGE):latest podman push $(IMAGE):latest
...@@ -80,13 +74,13 @@ showver: .release ...@@ -80,13 +74,13 @@ showver: .release
@. $(RELEASE_SUPPORT); getVersion @. $(RELEASE_SUPPORT); getVersion
tag-patch-release: VERSION := $(shell . $(RELEASE_SUPPORT); nextPatchLevel) 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: 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: VERSION := $(shell . $(RELEASE_SUPPORT); nextMajorLevel)
tag-major-release: .release tag tag-major-release: .release tag
patch-release: tag-patch-release release patch-release: tag-patch-release release
@echo $(VERSION) @echo $(VERSION)
......
include ../.utils/container-build.mk include ../.utils/container-build.mk
USERNAME=shivering-isles
pre-build: pre-build:
@echo do some stuff before the docker build @echo do some stuff before the docker build
......
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment