X-Git-Url: https://git.distorted.org.uk/~mdw/termux-packages/blobdiff_plain/88183689efb3715ac0192006cabad6337dea2588..eb5f02a8ceeaa1fec1bcca788159d01362dd921b:/scripts/run-docker.sh diff --git a/scripts/run-docker.sh b/scripts/run-docker.sh index 5e2ab677..fcbe3dab 100755 --- a/scripts/run-docker.sh +++ b/scripts/run-docker.sh @@ -1,15 +1,25 @@ #!/bin/sh set -e -u -# Create build output folder if necessary: -mkdir -p $HOME/termux - IMAGE_NAME=termux/package-builder +CONTAINER_NAME=termux-package-builder + +echo "Running container '$CONTAINER_NAME' from image '$IMAGE_NAME'..." + +docker start $CONTAINER_NAME > /dev/null 2> /dev/null || { + echo "Creating new container..." + docker run \ + --detach \ + --name $CONTAINER_NAME \ + --volume $PWD:/home/builder/termux-packages \ + --tty \ + $IMAGE_NAME +} -echo "Running container from image '$IMAGE_NAME'..." +if [ "$#" -eq "0" ]; then + docker exec --interactive --tty --user builder $CONTAINER_NAME bash +else + docker exec --interactive --tty --user builder $CONTAINER_NAME $@ +fi -docker run \ - -v $PWD:/root/termux-packages \ - -v $HOME/termux:/root/termux \ - -ti $IMAGE_NAME bash