2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 09:58:09 +00:00
criu/scripts/build/Dockerfile.alpine

46 lines
761 B
Docker
Raw Normal View History

FROM alpine
ARG CC=gcc
travis: enable ccache for docker/qemu builds As we compile-test non-x86_64 architectures under qemu emulation, it works pretty slow. Dmitry Safonov suggested, and Andrey Vagin initially implemented supporting ccache for such builds. This patch is based heavily on Andrey's work -- all the bugs added are purely mine though. Performance results: in an ideal environment (two builds of the same code, one with cold (empty) ccache, another with the hot one) I saw compile time improvements of 4x to 5x, and total test run time improvement up to 2x to 2.5x. In layman terms, the complete test run that was taking more than 50 minutes now takes about 25! Notes on handling .ccache directory: 1. Before running docker build, .ccache directory (saved in between runs by Travis) is moved to criu source code root, from where it is copied by docker together with criu sources. 2. In Dockerfile, .ccache gets moved to /tmp, and CCACHE_DIR is set accordingly. 3. After running docker build, .ccache is copied out from docker container back to the host (from where it is saved by Travis). Ccache envorinment notes: 1. CCACHE_NOCOMPRESS is needed because otherwise tons of time is spent on compression/decompression (big performance hit under qemu). 2. CCACHE_CPP2 is required with clang, see detailed explanation at http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html The logic of setting CCACHE_CPP2 in Dockerfile is somewhat fancy; unfortunately I was not able to come up with a simpler approach. Misc: 1. Travis runs "ccache -s" after the build is completed. A call to "ccache -s" is called to Dockerfile before make, so one can compare before/after numbers. 2. make invocations are surrounded by "date" calls so one can get the compilation times. Changes in v2: - consolidate Dockerfile statements (ENV, RUN) - single object make test is no longer commented out - simplify "make mrproper" test Signed-off-by: Kir Kolyshkin <kir@openvz.org> Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-16 14:27:36 -07:00
ARG ENV1=FOOBAR
RUN apk update && apk add \
$CC \
bash \
build-base \
ccache \
coreutils \
git \
libaio-dev \
libcap-dev \
libnet-dev \
libnl3-dev \
pkgconfig \
protobuf-c-dev \
protobuf-dev \
python \
sudo
COPY . /criu
WORKDIR /criu
travis: enable ccache for docker/qemu builds As we compile-test non-x86_64 architectures under qemu emulation, it works pretty slow. Dmitry Safonov suggested, and Andrey Vagin initially implemented supporting ccache for such builds. This patch is based heavily on Andrey's work -- all the bugs added are purely mine though. Performance results: in an ideal environment (two builds of the same code, one with cold (empty) ccache, another with the hot one) I saw compile time improvements of 4x to 5x, and total test run time improvement up to 2x to 2.5x. In layman terms, the complete test run that was taking more than 50 minutes now takes about 25! Notes on handling .ccache directory: 1. Before running docker build, .ccache directory (saved in between runs by Travis) is moved to criu source code root, from where it is copied by docker together with criu sources. 2. In Dockerfile, .ccache gets moved to /tmp, and CCACHE_DIR is set accordingly. 3. After running docker build, .ccache is copied out from docker container back to the host (from where it is saved by Travis). Ccache envorinment notes: 1. CCACHE_NOCOMPRESS is needed because otherwise tons of time is spent on compression/decompression (big performance hit under qemu). 2. CCACHE_CPP2 is required with clang, see detailed explanation at http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html The logic of setting CCACHE_CPP2 in Dockerfile is somewhat fancy; unfortunately I was not able to come up with a simpler approach. Misc: 1. Travis runs "ccache -s" after the build is completed. A call to "ccache -s" is called to Dockerfile before make, so one can compare before/after numbers. 2. make invocations are surrounded by "date" calls so one can get the compilation times. Changes in v2: - consolidate Dockerfile statements (ENV, RUN) - single object make test is no longer commented out - simplify "make mrproper" test Signed-off-by: Kir Kolyshkin <kir@openvz.org> Reviewed-by: Dmitry Safonov <dsafonov@virtuozzo.com> Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-16 14:27:36 -07:00
ENV CC="ccache $CC" CCACHE_DIR=/tmp/.ccache CCACHE_NOCOMPRESS=1 $ENV1=yes
RUN mv .ccache /tmp && make mrproper && ccache -sz && \
date && make -j $(nproc) CC="$CC" && date && ccache -s
RUN apk add \
py-yaml \
py-pip \
py2-future \
ip6tables \
iptables \
iproute2 \
tar \
bash \
go \
e2fsprogs \
asciidoc xmlto
# The rpc test cases are running as user #1000, let's add the user
RUN adduser -u 1000 -D test
RUN pip install protobuf ipaddress junit_xml
RUN make -C test/zdtm