github.com/ojongerius/docker@v1.11.2/hack/make/.ensure-syscall-test (about)

     1  #!/bin/bash
     2  set -e
     3  
     4  # Build a C binary for cloning a userns for seccomp tests
     5  # and compile it for target daemon
     6  if [ "$DOCKER_ENGINE_GOOS" = "linux" ]; then
     7  	if [ "$DOCKER_ENGINE_OSARCH" = "$DOCKER_CLIENT_OSARCH" ]; then
     8  		tmpdir=$(mktemp -d)
     9  		gcc -g -Wall -static contrib/syscall-test/userns.c -o "${tmpdir}/userns-test"
    10  		gcc -g -Wall -static contrib/syscall-test/ns.c -o "${tmpdir}/ns-test"
    11  		gcc -g -Wall -static contrib/syscall-test/acct.c -o "${tmpdir}/acct-test"
    12  
    13  		dockerfile="${tmpdir}/Dockerfile"
    14  		cat <<-EOF > "$dockerfile"
    15  		FROM debian:jessie
    16  		COPY . /usr/bin/
    17  		EOF
    18  		docker build --force-rm ${DOCKER_BUILD_ARGS} -qt syscall-test "${tmpdir}" > /dev/null
    19  		rm -rf "${tmpdir}"
    20  	else
    21  		docker build ${DOCKER_BUILD_ARGS} -qt syscall-test contrib/syscall-test > /dev/null
    22  	fi
    23  fi