ARG CC=gcc

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 \
                libcap-dev \
                iptables \
                libnl-3-dev \
                libselinux-dev \
                pkg-config \
                git-core \
		libnet-dev \
                $CC

COPY . /criu
WORKDIR /criu

RUN make mrproper
RUN make -j $(nproc) CC=$CC V=1 criu/parasite-syscall.o
RUN make -j $(nproc) CC=$CC V=1
RUN make mrproper
RUN bash -c 'CLEAN="$(git clean -ndx --exclude=scripts/build --exclude=.config)"; echo "${CLEAN}"; test -z "${CLEAN}"; exit $?'
RUN make -j $(nproc) CC=$CC -C test/zdtm
