arm: do not rely on host arch, specify --platform and CGO_ENABLED

Since we are building arm on arm64 machines we have to specify the desired platform
and not rely on the host's architecture.

Also when building arm on arm64 machines, there can be issues with cgo.
So this patch makes sure CGO_ENABLED env var gets passed on as a build arg.

Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
Tibor Vass 2021-04-06 04:48:43 +00:00
Родитель 60e28c914d
Коммит c04ab6da6a
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -75,5 +75,5 @@ deb: checkout ## build deb packages
static: DOCKER_BUILD_PKGS:=static-linux cross-mac cross-win cross-arm
static: checkout ## build static-compiled packages
for p in $(DOCKER_BUILD_PKGS); do \
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) $${p}; \
$(MAKE) -C $@ VERSION=$(VERSION) GO_VERSION=$(GO_VERSION) TARGETPLATFORM=$(TARGETPLATFORM) $${p}; \
done

Просмотреть файл

@ -74,7 +74,7 @@ cross-arm: cross-all-cli ## create tgz with linux armhf client only
.PHONY: static-cli
static-cli:
$(MAKE) -C $(CLI_DIR) -f docker.Makefile VERSION=$(GEN_STATIC_VER) build
cd $(CLI_DIR) && VERSION=$(GEN_STATIC_VER) docker buildx bake --set binary.platform=$(TARGETPLATFORM) --set binary.args.CGO_ENABLED=$(CGO_ENABLED) binary
.PHONY: static-engine
static-engine: