github.com/sijibomii/docker@v0.0.0-20231230191044-5cf6ca554647/hack/make/.ensure-nnp-test (about) 1 #!/bin/bash 2 set -e 3 4 # Build a C binary for testing no-new-privileges 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/nnp-test/nnp-test.c -o "${tmpdir}/nnp-test" 10 11 dockerfile="${tmpdir}/Dockerfile" 12 cat <<-EOF > "$dockerfile" 13 FROM debian:jessie 14 COPY . /usr/bin/ 15 RUN chmod +s /usr/bin/nnp-test 16 EOF 17 docker build --force-rm ${DOCKER_BUILD_ARGS} -qt nnp-test "${tmpdir}" > /dev/null 18 rm -rf "${tmpdir}" 19 else 20 docker build ${DOCKER_BUILD_ARGS} -qt nnp-test contrib/nnp-test > /dev/null 21 fi 22 fi