[CRIU] [PATCH 3/3] dockerfile: extract a common part in one file
Andrey Vagin
avagin at openvz.org
Thu Feb 18 09:41:08 PST 2016
From: Andrew Vagin <avagin at virtuozzo.com>
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
Dockerfile | 18 -----------------
Makefile | 5 +++--
scripts/build/Dockerfile.aarch64 | 22 --------------------
scripts/build/Dockerfile.aarch64.hdr | 3 +++
scripts/build/Dockerfile.armv7hf | 22 --------------------
scripts/build/Dockerfile.armv7hf.hdr | 3 +++
scripts/build/Dockerfile.ppc64le | 22 --------------------
scripts/build/Dockerfile.ppc64le.hdr | 3 +++
scripts/build/Dockerfile.x86_64.hdr | 1 +
scripts/build/Makefile | 39 ++++++++++++++++++++++++++++--------
10 files changed, 44 insertions(+), 94 deletions(-)
delete mode 100644 Dockerfile
delete mode 100644 scripts/build/Dockerfile.aarch64
create mode 100644 scripts/build/Dockerfile.aarch64.hdr
delete mode 100644 scripts/build/Dockerfile.armv7hf
create mode 100644 scripts/build/Dockerfile.armv7hf.hdr
delete mode 100644 scripts/build/Dockerfile.ppc64le
create mode 100644 scripts/build/Dockerfile.ppc64le.hdr
create mode 100644 scripts/build/Dockerfile.x86_64.hdr
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 1d1bb16..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM ubuntu:utopic
-
-RUN apt-get update && apt-get install -y \
- build-essential \
- protobuf-c-compiler \
- libprotobuf-c0-dev \
- libprotobuf-dev \
- bsdmainutils \
- protobuf-compiler \
- python-minimal \
- libaio-dev \
- iptables
-
-COPY . /criu
-WORKDIR /criu
-
-RUN make clean && make -j $(nproc)
-RUN make -j $(nproc) -C test ZDTM_ARGS="-C -x static/rtc -x mountpoint -x static/cgroup02 -x tcp6 -x tcpbuf6"
diff --git a/Makefile b/Makefile
index 3e95df3..31631db 100644
--- a/Makefile
+++ b/Makefile
@@ -184,11 +184,12 @@ gcov:
PHONY += gcov
docker-build:
- docker build -t criu .
+ $(MAKE) -C scripts/build/ x86_64
+
PHONY += docker-build
docker-test:
- docker run --rm -it --privileged criu ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
+ docker run --rm -it --privileged criu-x86_64 ./test/zdtm.sh -C -x tcp6 -x tcpbuf6 -x static/rtc -x cgroup -x mountpoint
PHONY += docker-test
help:
diff --git a/scripts/build/Dockerfile.aarch64 b/scripts/build/Dockerfile.aarch64
deleted file mode 100644
index 4145448..0000000
--- a/scripts/build/Dockerfile.aarch64
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM aarch64/ubuntu:trusty
-
-COPY scripts/build/qemu-user-static/usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
-
-RUN apt-get update
-
-RUN apt-get update && apt-get install -y \
- build-essential \
- protobuf-c-compiler \
- libprotobuf-c0-dev \
- libprotobuf-dev \
- bsdmainutils \
- protobuf-compiler \
- python-minimal \
- libaio-dev \
- iptables \
- libnl-3-dev
-
-COPY . /criu
-WORKDIR /criu
-
-RUN make clean && make -j $(nproc)
diff --git a/scripts/build/Dockerfile.aarch64.hdr b/scripts/build/Dockerfile.aarch64.hdr
new file mode 100644
index 0000000..3dd8600
--- /dev/null
+++ b/scripts/build/Dockerfile.aarch64.hdr
@@ -0,0 +1,3 @@
+FROM aarch64/ubuntu:trusty
+
+COPY scripts/build/qemu-user-static/usr/bin/qemu-aarch64-static /usr/bin/qemu-aarch64-static
diff --git a/scripts/build/Dockerfile.armv7hf b/scripts/build/Dockerfile.armv7hf
deleted file mode 100644
index e4a4455..0000000
--- a/scripts/build/Dockerfile.armv7hf
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM armv7/armhf-ubuntu
-
-COPY scripts/build/qemu-user-static/usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
-
-RUN apt-get update
-
-RUN apt-get update && apt-get install -y \
- build-essential \
- protobuf-c-compiler \
- libprotobuf-c0-dev \
- libprotobuf-dev \
- bsdmainutils \
- protobuf-compiler \
- python-minimal \
- libaio-dev \
- iptables \
- libnl-3-dev
-
-COPY . /criu
-WORKDIR /criu
-
-RUN make clean && make -j $(nproc)
diff --git a/scripts/build/Dockerfile.armv7hf.hdr b/scripts/build/Dockerfile.armv7hf.hdr
new file mode 100644
index 0000000..8d4a9c8
--- /dev/null
+++ b/scripts/build/Dockerfile.armv7hf.hdr
@@ -0,0 +1,3 @@
+FROM armv7/armhf-ubuntu
+
+COPY scripts/build/qemu-user-static/usr/bin/qemu-arm-static /usr/bin/qemu-arm-static
diff --git a/scripts/build/Dockerfile.ppc64le b/scripts/build/Dockerfile.ppc64le
deleted file mode 100644
index 9c83d8a..0000000
--- a/scripts/build/Dockerfile.ppc64le
+++ /dev/null
@@ -1,22 +0,0 @@
-FROM ppc64le/ubuntu
-
-COPY scripts/build/qemu-user-static/usr/bin/qemu-ppc64le-static /usr/bin/qemu-ppc64le-static
-
-RUN apt-get update
-
-RUN apt-get update && apt-get install -y \
- build-essential \
- protobuf-c-compiler \
- libprotobuf-c0-dev \
- libprotobuf-dev \
- bsdmainutils \
- protobuf-compiler \
- python-minimal \
- libaio-dev \
- iptables \
- libnl-3-dev
-
-COPY . /criu
-WORKDIR /criu
-
-RUN make clean && make -j $(nproc)
diff --git a/scripts/build/Dockerfile.ppc64le.hdr b/scripts/build/Dockerfile.ppc64le.hdr
new file mode 100644
index 0000000..7976d4e
--- /dev/null
+++ b/scripts/build/Dockerfile.ppc64le.hdr
@@ -0,0 +1,3 @@
+FROM ppc64le/ubuntu
+
+COPY scripts/build/qemu-user-static/usr/bin/qemu-ppc64le-static /usr/bin/qemu-ppc64le-static
diff --git a/scripts/build/Dockerfile.x86_64.hdr b/scripts/build/Dockerfile.x86_64.hdr
new file mode 100644
index 0000000..310e6b2
--- /dev/null
+++ b/scripts/build/Dockerfile.x86_64.hdr
@@ -0,0 +1 @@
+FROM ubuntu:wily
diff --git a/scripts/build/Makefile b/scripts/build/Makefile
index d2e5f94..4b90a91 100644
--- a/scripts/build/Makefile
+++ b/scripts/build/Makefile
@@ -1,24 +1,47 @@
all: armv7hf aarch64 ppc64le
+AARCH64_IMG ?= aarch64/ubuntu:trusty
+ARMV7HF_IMG ?= armv7/armhf-ubuntu
+PPC64LE_IMG ?= ppc64le/ubuntu
+
.FORCE:
+Dockerfile.aarch64: Dockerfile.aarch64.hdr Dockerfile.tmpl
+ cat Dockerfile.aarch64.hdr > Dockerfile.aarch64
+ cat Dockerfile.tmpl >> Dockerfile.aarch64
+
+Dockerfile.armv7hf: Dockerfile.armv7hf.hdr Dockerfile.tmpl
+ cat Dockerfile.armv7hf.hdr > Dockerfile.armv7hf
+ cat Dockerfile.tmpl >> Dockerfile.armv7hf
+
+Dockerfile.ppc64le: Dockerfile.ppc64le.hdr Dockerfile.tmpl
+ cat Dockerfile.ppc64le.hdr > Dockerfile.ppc64le
+ cat Dockerfile.tmpl >> Dockerfile.ppc64le
+
+Dockerfile.x86_64: Dockerfile.x86_64.hdr Dockerfile.tmpl
+ cat Dockerfile.x86_64.hdr > Dockerfile.x86_64
+ cat Dockerfile.tmpl >> Dockerfile.x86_64
+
qemu-user-static:
./extract-deb-pkg qemu-user-static
binfmt_misc: .FORCE
./binfmt_misc
-armv7hf: qemu-user-static binfmt_misc
+armv7hf: qemu-user-static binfmt_misc Dockerfile.armv7hf
docker build -t criu-armv7hf -f Dockerfile.armv7hf ../..
-aarch64: qemu-user-static binfmt_misc
+aarch64: qemu-user-static binfmt_misc Dockerfile.aarch64
docker build -t criu-aarch64 -f Dockerfile.aarch64 ../..
-ppc64le: qemu-user-static binfmt_misc
- docker build -t criu-aarch64 -f Dockerfile.ppc64le ../..
+ppc64le: qemu-user-static binfmt_misc Dockerfile.ppc64le
+ docker build -t criu-ppc64le -f Dockerfile.ppc64le ../..
+
+x86_64: Dockerfile.x86_64
+ docker build -t criu-x86_64 -f Dockerfile.x86_64 ../..
clean:
- echo -1 > /proc/sys/fs/binfmt_misc/ppc64le
- echo -1 > /proc/sys/fs/binfmt_misc/armv7hf
- echo -1 > /proc/sys/fs/binfmt_misc/aarch64
- rm -rf qemu-user-static
+ [ ! -f /proc/sys/fs/binfmt_misc/ppc64le ] || echo -1 > /proc/sys/fs/binfmt_misc/ppc64le
+ [ ! -f /proc/sys/fs/binfmt_misc/armv7hf ] || echo -1 > /proc/sys/fs/binfmt_misc/armv7hf
+ [ ! -f /proc/sys/fs/binfmt_misc/aarch64 ] || echo -1 > /proc/sys/fs/binfmt_misc/aarch64
+ rm -rf qemu-user-static Dockerfile.aarch64 Dockerfile.armv7hf Dockerfile.ppc64le Dockerfile.x86_64
--
2.5.0
More information about the CRIU
mailing list