| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
set -e |
| 4 |
|
| 5 |
# go to the repo root |
| 6 |
cd $(dirname $0)/../../../.. |
| 7 |
|
| 8 |
if [[ -t 0 ]]; then |
| 9 |
DOCKER_TTY_ARGS="-it" |
| 10 |
else |
| 11 |
# The input device on kokoro is not a TTY, so -it does not work. |
| 12 |
DOCKER_TTY_ARGS= |
| 13 |
fi |
| 14 |
|
| 15 |
# Pin the dockcross image since newer versions of the image break the build |
| 16 |
PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20210803-41e5c69 |
| 17 |
|
| 18 |
# running dockcross image without any arguments generates a wrapper |
| 19 |
# scripts that can be used to run commands under the dockcross image |
| 20 |
# easily. |
| 21 |
# See https://github.com/dockcross/dockcross#usage for details |
| 22 |
docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-manylinux2014-aarch64.sh |
| 23 |
chmod +x dockcross-manylinux2014-aarch64.sh |
| 24 |
|
| 25 |
# the wrapper script has CRLF line endings and bash doesn't like that |
| 26 |
# so we change CRLF line endings into LF. |
| 27 |
sed -i 's/\r//g' dockcross-manylinux2014-aarch64.sh |
| 28 |
|
| 29 |
# The dockcross wrapper script runs arbitrary commands under the selected dockcross |
| 30 |
# image with the following properties which make its use very convenient: |
| 31 |
# * the current working directory is mounted under /work so the container can easily |
| 32 |
# access the current workspace |
| 33 |
# * the processes in the container run under the same UID and GID as the host process so unlike |
| 34 |
# vanilla "docker run" invocations, the workspace doesn't get polluted with files |
| 35 |
# owned by root. |
| 36 |
./dockcross-manylinux2014-aarch64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@" |