2015-12-30 14:20:23 -05:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Build a C binary for cloning a userns for seccomp tests
|
|
|
|
# and compile it for target daemon
|
|
|
|
if [ "$DOCKER_ENGINE_GOOS" = "linux" ]; then
|
2016-01-20 13:05:37 -05:00
|
|
|
if [ "$DOCKER_ENGINE_OSARCH" = "$DOCKER_CLIENT_OSARCH" ]; then
|
|
|
|
tmpdir=$(mktemp -d)
|
|
|
|
gcc -g -Wall -static contrib/syscall-test/userns.c -o "${tmpdir}/userns-test"
|
|
|
|
gcc -g -Wall -static contrib/syscall-test/ns.c -o "${tmpdir}/ns-test"
|
|
|
|
gcc -g -Wall -static contrib/syscall-test/acct.c -o "${tmpdir}/acct-test"
|
|
|
|
|
|
|
|
dockerfile="${tmpdir}/Dockerfile"
|
|
|
|
cat <<-EOF > "$dockerfile"
|
2016-02-09 13:13:38 -05:00
|
|
|
FROM debian:jessie
|
2016-01-20 13:05:37 -05:00
|
|
|
COPY . /usr/bin/
|
|
|
|
EOF
|
|
|
|
docker build --force-rm ${DOCKER_BUILD_ARGS} -qt syscall-test "${tmpdir}" > /dev/null
|
|
|
|
rm -rf "${tmpdir}"
|
|
|
|
else
|
|
|
|
docker build ${DOCKER_BUILD_ARGS} -qt syscall-test contrib/syscall-test > /dev/null
|
|
|
|
fi
|
2015-12-30 14:20:23 -05:00
|
|
|
fi
|