tests/docker: use direct RUNC call to build containers
We don't really need stuff from docker.py to do the build as we have everything we need with a direct call. We do rely on the dockerfiles being able to tweak the UID/name mapping as the last step. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20230228190653.1602033-21-alex.bennee@linaro.org>
This commit is contained in:
parent
93bd2954f4
commit
0b1a649047
|
@ -7,6 +7,8 @@ SPACE := $(NULL) #
|
||||||
COMMA := ,
|
COMMA := ,
|
||||||
|
|
||||||
HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
|
HOST_ARCH = $(if $(ARCH),$(ARCH),$(shell uname -m))
|
||||||
|
USER = $(if $(NOUSER),,$(shell id -un))
|
||||||
|
UID = $(if $(NOUSER),,$(shell id -u))
|
||||||
|
|
||||||
DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
|
DOCKER_FILES_DIR := $(SRC_PATH)/tests/docker/dockerfiles
|
||||||
ifeq ($(HOST_ARCH),x86_64)
|
ifeq ($(HOST_ARCH),x86_64)
|
||||||
|
@ -14,6 +16,7 @@ DOCKER_DEFAULT_REGISTRY := registry.gitlab.com/qemu-project/qemu
|
||||||
endif
|
endif
|
||||||
DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
|
DOCKER_REGISTRY := $(if $(REGISTRY),$(REGISTRY),$(DOCKER_DEFAULT_REGISTRY))
|
||||||
|
|
||||||
|
RUNC ?= docker
|
||||||
ENGINE ?= auto
|
ENGINE ?= auto
|
||||||
DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
|
DOCKER_SCRIPT=$(SRC_PATH)/tests/docker/docker.py --engine $(ENGINE)
|
||||||
|
|
||||||
|
@ -35,15 +38,17 @@ docker-qemu-src: $(DOCKER_SRC_COPY)
|
||||||
|
|
||||||
# General rule for building docker images.
|
# General rule for building docker images.
|
||||||
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
docker-image-%: $(DOCKER_FILES_DIR)/%.docker
|
||||||
$(call quiet-command,\
|
$(call quiet-command, \
|
||||||
$(DOCKER_SCRIPT) build -t qemu/$* -f $< \
|
$(RUNC) build \
|
||||||
$(if $V,,--quiet) \
|
$(if $V,,--quiet) \
|
||||||
$(if $(NOCACHE),--no-cache, \
|
$(if $(NOCACHE),--no-cache, \
|
||||||
$(if $(DOCKER_REGISTRY),--registry $(DOCKER_REGISTRY))) \
|
$(if $(DOCKER_REGISTRY),--cache-from $(DOCKER_REGISTRY)/qemu/$*)) \
|
||||||
$(if $(NOUSER),,--add-current-user) \
|
--build-arg BUILDKIT_INLINE_CACHE=1 \
|
||||||
$(if $(EXTRA_FILES),--extra-files $(EXTRA_FILES))\
|
$(if $(NOUSER),, \
|
||||||
$(if $(EXECUTABLE),--include-executable=$(EXECUTABLE)),\
|
--build-arg USER=$(USER) \
|
||||||
"BUILD","$*")
|
--build-arg UID=$(UID)) \
|
||||||
|
-t qemu/$* - < $<, \
|
||||||
|
"BUILD", $1)
|
||||||
|
|
||||||
# Special rule for debootstraped binfmt linux-user images
|
# Special rule for debootstraped binfmt linux-user images
|
||||||
docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
|
docker-binfmt-image-debian-%: $(DOCKER_FILES_DIR)/debian-bootstrap.docker
|
||||||
|
|
Loading…
Reference in New Issue