Files
cozystack/scripts/common-envs.mk

25 lines
1.1 KiB
Makefile

REGISTRY := ghcr.io/cozystack/cozystack
PUSH := 1
LOAD := 0
COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags))
TAG = $(shell git describe --tags --exact-match 2>/dev/null || echo latest)
# Returns 'latest' if the git tag is not assigned, otherwise returns the provided value
define settag
$(if $(filter $(TAG),latest),latest,$(1))
endef
ifeq ($(COZYSTACK_VERSION),)
$(shell git remote add upstream https://github.com/cozystack/cozystack.git || true)
$(shell git fetch upstream --tags)
COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags))
endif
# Get the name of the default docker buildx builder
BUILDER ?= $(shell jq -r '.Name' ~/.docker/buildx/current)
# Get platforms supported by the builder
# TODO: figure out how to get runners status dynamically, in json
# PLATFORM ?= $(shell jq -r '.Nodes[] | .Platforms | map(.os + "/" + .architecture) | join(",")' ~/.docker/buildx/instances/$(BUILDER))
PLATFORM ?= $(shell docker buildx inspect --bootstrap $(BUILDER) | egrep '^Platforms:' | egrep -o 'linux/amd64|linux/arm64' | sort -u | xargs | sed 's/ /,/g')