mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 18:18:41 +00:00
[519] Cross-arch builds: builders variables (#907)
Added PLATFORM variable to `common-envs.mk`: if not defined, it is calculated based on docker daemon arch. May be overridden by e.g. `make -e PLATFORM='linux/arm64' ...` Added the variable to a single Dockerfile for now.
This commit is contained in:
@@ -9,6 +9,8 @@ image: image-cozystack-controller update-version
|
||||
image-cozystack-controller:
|
||||
docker buildx build -f images/cozystack-controller/Dockerfile ../../.. \
|
||||
--provenance false \
|
||||
--builder=$(BUILDER) \
|
||||
--platform=$(PLATFORM) \
|
||||
--tag $(REGISTRY)/cozystack-controller:$(call settag,$(TAG)) \
|
||||
--cache-from type=registry,ref=$(REGISTRY)/cozystack-controller:latest \
|
||||
--cache-to type=inline \
|
||||
|
||||
@@ -14,3 +14,9 @@ ifeq ($(COZYSTACK_VERSION),)
|
||||
$(shell git fetch upstream --tags)
|
||||
COZYSTACK_VERSION = $(patsubst v%,%,$(shell git describe --tags))
|
||||
endif
|
||||
|
||||
# Get the name of the selected docker buildx builder
|
||||
BUILDER ?= $(shell docker buildx inspect --bootstrap | head -n2 | awk '/^Name:/{print $$NF}')
|
||||
# Get platforms supported by the builder
|
||||
PLATFORM ?= $(shell docker buildx ls --format=json | jq -r 'select(.Name == "$(BUILDER)") | [.Nodes[].Platforms // []] | flatten | unique | map(select(test("^linux/amd64$$|^linux/arm64$$"))) | join(",")')
|
||||
|
||||
|
||||
Reference in New Issue
Block a user