Browse Source

Proper tty support for build.sh

ugv_io
Alex Mikhalev 6 years ago
parent
commit
e1f6cea405
  1. 11
      build.sh

11
build.sh

@ -5,8 +5,15 @@ set -e -x
DIR=$(cd "$(dirname "$0")"; pwd -P) DIR=$(cd "$(dirname "$0")"; pwd -P)
TOOLCHAIN_IMAGE="esp32-toolchain:latest" TOOLCHAIN_IMAGE="esp32-toolchain:latest"
BUILD_DIR="$DIR/cmake-build" : ${BUILD_DIR:="$DIR/cmake-build"}
DOCKERFILE="$DIR/Dockerfile" DOCKERFILE="$DIR/Dockerfile"
DOCKER_RUN_FLAGS=(--interactive --rm)
# if stdin is a terminal, tell docker to allocate a tty
if [ -t 0 ]; then
DOCKER_RUN_FLAGS+=(--tty)
fi
build_docker_container() { build_docker_container() {
docker build -f "$DOCKERFILE" -t "$TOOLCHAIN_IMAGE" "$DIR" docker build -f "$DOCKERFILE" -t "$TOOLCHAIN_IMAGE" "$DIR"
@ -16,7 +23,7 @@ build_docker() {
build_docker_container build_docker_container
docker run \ docker run \
--volume="$DIR:/esp/uas-ugv" \ --volume="$DIR:/esp/uas-ugv" \
--interactive --tty --rm \ "${DOCKER_RUN_FLAGS[@]}" \
"$TOOLCHAIN_IMAGE" \ "$TOOLCHAIN_IMAGE" \
/esp/uas-ugv/build.sh cmake "$@" /esp/uas-ugv/build.sh cmake "$@"
} }

Loading…
Cancel
Save