Merge pull request #1069 from aledbf/master

Export TEMP_DIR variable in Makefile
This commit is contained in:
Manuel Alejandro de Brito Fontes 2017-08-03 11:11:47 -04:00 committed by GitHub
commit 391d0b5892

View file

@ -54,7 +54,9 @@ endif
# QEMUARCH=s390x # QEMUARCH=s390x
#endif #endif
TEMP_DIR ?= $(shell mktemp -d) export TEMP_DIR ?= $(shell mktemp -d)
DOCKERFILE := $(TEMP_DIR)/rootfs/Dockerfile
all: all-container all: all-container
@ -71,19 +73,19 @@ all-push: $(addprefix sub-push-,$(ALL_ARCH))
container: .container-$(ARCH) container: .container-$(ARCH)
.container-$(ARCH): .container-$(ARCH):
cp -r ./* $(TEMP_DIR) cp -r ./* $(TEMP_DIR)
cd $(TEMP_DIR) && $(SED_I) 's|BASEIMAGE|$(BASEIMAGE)|g' rootfs/Dockerfile $(SED_I) 's|BASEIMAGE|$(BASEIMAGE)|g' $(DOCKERFILE)
cd $(TEMP_DIR) && $(SED_I) "s|QEMUARCH|$(QEMUARCH)|g" rootfs/Dockerfile $(SED_I) "s|QEMUARCH|$(QEMUARCH)|g" $(DOCKERFILE)
cd $(TEMP_DIR) && $(SED_I) "s|DUMB_ARCH|$(DUMB_ARCH)|g" rootfs/Dockerfile $(SED_I) "s|DUMB_ARCH|$(DUMB_ARCH)|g" $(DOCKERFILE)
ifeq ($(ARCH),amd64) ifeq ($(ARCH),amd64)
# When building "normally" for amd64, remove the whole line, it has no part in the amd64 image # When building "normally" for amd64, remove the whole line, it has no part in the amd64 image
cd $(TEMP_DIR) && $(SED_I) "/CROSS_BUILD_/d" rootfs/Dockerfile $(SED_I) "/CROSS_BUILD_/d" $(DOCKERFILE)
else else
# When cross-building, only the placeholder "CROSS_BUILD_" should be removed # When cross-building, only the placeholder "CROSS_BUILD_" should be removed
# Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel # Register /usr/bin/qemu-ARCH-static as the handler for ARM binaries in the kernel
$(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset $(DOCKER) run --rm --privileged multiarch/qemu-user-static:register --reset
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)/rootfs curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C $(TEMP_DIR)/rootfs
cd $(TEMP_DIR) && $(SED_I) "s/CROSS_BUILD_//g" rootfs/Dockerfile $(SED_I) "s/CROSS_BUILD_//g" $(DOCKERFILE)
endif endif
$(DOCKER) build -t $(MULTI_ARCH_IMG):$(TAG) $(TEMP_DIR)/rootfs $(DOCKER) build -t $(MULTI_ARCH_IMG):$(TAG) $(TEMP_DIR)/rootfs