Refactor multi-arch support (especially for new mostly-official multi-arch official images)

See 99433d2ca2/README.md (architectures-other-than-amd64) for some context of where these images come from.

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>
This commit is contained in:
Tianon Gravi
2016-01-04 21:50:15 -08:00
parent 18fdbdb07b
commit 91201678c6
8 changed files with 369 additions and 159 deletions

View File

@@ -1,14 +1,27 @@
.PHONY: all binary build cross default docs docs-build docs-shell shell test test-docker-py test-integration-cli test-unit validate
# get OS/Arch of docker engine
DOCKER_ENGINE_OSARCH = $(shell docker version | grep 'OS/Arch' | tail -1 | cut -d':' -f2 | tr -d '[[:space:]]')
DOCKER_OSARCH := $(shell bash -c 'source hack/make/.detect-daemon-osarch && echo $${DOCKER_ENGINE_OSARCH:+$$DOCKER_CLIENT_OSARCH}')
# default for linux/amd64 and others
DOCKER_FILE = Dockerfile
DOCKERFILE := Dockerfile
# switch to different Dockerfile for linux/arm
ifeq ($(DOCKER_ENGINE_OSARCH),linux/arm)
DOCKER_FILE = Dockerfile.armhf
ifeq ($(DOCKER_OSARCH), linux/arm)
DOCKERFILE := Dockerfile.armhf
else
ifeq ($(DOCKER_OSARCH), linux/arm64)
# TODO .arm64
DOCKERFILE := Dockerfile.armhf
else
ifeq ($(DOCKER_OSARCH), linux/ppc64le)
DOCKERFILE := Dockerfile.ppc64le
else
ifeq ($(DOCKER_OSARCH), linux/s390x)
DOCKERFILE := Dockerfile.s390x
endif
export DOCKER_FILE
endif
endif
endif
export DOCKERFILE
# env vars passed through directly to Docker's build scripts
# to allow things like `make DOCKER_CLIENTONLY=1 binary` easily
@@ -18,7 +31,7 @@ DOCKER_ENVS := \
-e DOCKER_CLIENTONLY \
-e DOCKER_DEBUG \
-e DOCKER_EXPERIMENTAL \
-e DOCKER_FILE \
-e DOCKERFILE \
-e DOCKER_GRAPHDRIVER \
-e DOCKER_REMAP_ROOT \
-e DOCKER_STORAGE_OPTS \
@@ -60,7 +73,7 @@ binary: build
$(DOCKER_RUN_DOCKER) hack/make.sh binary
build: bundles
docker build -t "$(DOCKER_IMAGE)" -f $(DOCKER_FILE) .
docker build -t "$(DOCKER_IMAGE)" -f "$(DOCKERFILE)" .
bundles:
mkdir bundles