Use exact build context for kernel build

Saves passing too much context, less error prone and should
mean builds are faster if not clean, consistent with elsewhere.

Signed-off-by: Justin Cormack <justin.cormack@docker.com>
This commit is contained in:
Justin Cormack 2016-12-15 10:40:55 -08:00
parent bca12fbd3e
commit 0b7ffbd135

View File

@ -3,9 +3,9 @@ DEBUG ?= 0
all: x86_64/vmlinuz64
ifdef AUFS
x86_64/vmlinuz64: Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs
x86_64/vmlinuz64: Dockerfile.aufs kernel_config kernel_config.debug kernel_config.aufs patches-aufs
mkdir -p x86_64 etc lib usr sbin
BUILD=$$( docker build -f Dockerfile.aufs --build-arg DEBUG=$(DEBUG) -q . ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
BUILD=$$( tar cf - $^ | docker build -f Dockerfile.aufs --build-arg DEBUG=$(DEBUG) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
docker run --rm --net=none --log-driver=none $$BUILD cat /kernel-modules.tar | tar xf - && \
docker run --rm --net=none --log-driver=none $$BUILD cat /aufs-utils.tar | tar xf - && \
docker run --rm --net=none --log-driver=none $$BUILD cat /kernel-source-info > etc/kernel-source-info && \
@ -14,9 +14,9 @@ x86_64/vmlinuz64: Dockerfile.aufs kernel_config kernel_config.debug kernel_confi
docker run --rm --net=none --log-driver=none $$BUILD cat /kernel-headers.tar > x86_64/kernel-headers.tar && \
cp -a patches-aufs etc/kernel-patches
else
x86_64/vmlinuz64: Dockerfile kernel_config kernel_config.debug
x86_64/vmlinuz64: Dockerfile kernel_config kernel_config.debug patches
mkdir -p x86_64 etc lib usr sbin
BUILD=$$( docker build --build-arg DEBUG=$(DEBUG) -q . ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
BUILD=$$( tar cf - $^ | docker build --build-arg DEBUG=$(DEBUG) -q - ) && [ -n "$$BUILD" ] && echo "Built $$BUILD" && \
docker run --rm --net=none --log-driver=none $$BUILD cat /kernel-modules.tar | tar xf - && \
docker run --rm --net=none --log-driver=none $$BUILD cat /kernel-source-info > etc/kernel-source-info && \
docker run --rm --net=none --log-driver=none $$BUILD cat /linux/vmlinux > x86_64/vmlinux && \