gpu-jupyter/start-local.sh

30 lines
822 B
Bash
Raw Normal View History

2019-11-12 21:22:20 +00:00
#!/usr/bin/env bash
cd $(cd -P -- "$(dirname -- "$0")" && pwd -P)
2019-11-13 14:45:07 +00:00
# Fetching port and network as input
PORT=8888
while [[ "$#" -gt 0 ]]; do case $1 in
-p|--port) PORT="$2"; shift;;
# -u|--uglify) uglify=1;;
*) echo "Unknown parameter passed: $1"; exit 1;;
esac; shift; done
# Check if arguments are valid
if [[ $PORT != [0-9][0-9][0-9][0-9]* ]]; then
echo "Given port is not valid."
2019-11-14 10:56:43 +00:00
echo "Usage: $0 -p [port] # port must be an integer with 4 or more digits."
2019-11-13 14:45:07 +00:00
exit 21
fi
# starting in docker-compose
echo "Starting gpu-jupyter via docker-compose on port $PORT."
export JUPYTER_PORT=$PORT
2021-01-26 20:14:29 +00:00
export UID=$(id -u)
export GID=$(id -g)
2019-11-13 14:45:07 +00:00
# echo $JUPYTER_PORT
2019-11-12 21:22:20 +00:00
docker-compose up --build -d
2019-11-13 14:45:07 +00:00
echo
2019-11-14 10:56:43 +00:00
echo "Started gpu-jupyter via docker-compose on localhost:$JUPYTER_PORT."
2019-11-13 14:45:07 +00:00
echo "See docker-compose logs -f for logs."