Add PLATFORM make variable; calculate it if undefined

Signed-off-by: nbykov0 <166552198+nbykov0@users.noreply.github.com>
This commit is contained in:
nbykov0
2025-04-30 23:44:06 +03:00
parent 557ffa536f
commit 6ad30915eb

View File

@@ -14,3 +14,16 @@ ifeq ($(COZYSTACK_VERSION),)
$(shell git fetch upstream --tags)
COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags))
endif
# Calculate PLATFORM based on current docker daemon arch
ifndef PLATFORM
DOCKER_DAEMON_ARCH := $(shell docker info --format='{{.Architecture}}')
ifeq ($(DOCKER_DAEMON_ARCH),x86_64)
PLATFORM := linux/amd64
else ifeq ($(DOCKER_DAEMON_ARCH),aarch64)
PLATFORM := linux/arm64
else
$(error Unsupported architecture: "$(DOCKER_DAEMON_ARCH)")
endif
undefine DOCKER_DAEMON_ARCH
endif