You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.4 KiB

3 years ago
#!/bin/bash
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
TARGET="$(readlink "$SOURCE")"
if [[ $TARGET == /* ]]; then
SOURCE="$TARGET"
else
DIR="$( dirname "$SOURCE" )"
SOURCE="$DIR/$TARGET" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
fi
done
SRPATH="$( dirname "$SOURCE" )"
SFPATH="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
if [ "$SFPATH" != "$SRPATH" ]; then
RDIR=$SRPATH # relativ path directory
fi
cwdir=$PWD
wdir=$SFPATH
if [[ $# -eq 0 ]] ; then
echo 'no service'
exit 1
fi
if [[ -z "$1" ]] ; then
echo 'no service'
exit 1
fi
service=$1
servicebase=$(echo $service | cut -d'_' -f1)
#code-server --disable-update-check --bind-addr 0.0.0.0:8080 --user-data-dir /home --auth none &
#firefox http://127.0.0.1:8080
xhost +local:docker
docker run --rm --volumes-from $service -e TZ=Europe/Athens -e DISPLAY=$DISPLAY -v $(pwd)/swarmlab_editor_service:/tmp/start -v /tmp/.X11-unix:/tmp/.X11-unix hub.swarmlab.io:5480/swarmlab-codeserver /bin/bash -c "/tmp/start"
#docker run --rm --volumes-from $service -e TZ=Europe/Athens -e DISPLAY=$DISPLAY --mount type=bind,source=$(pwd)/swarmlab_editor_service,target=/tmp/start -v /tmp/.X11-unix:/tmp/.X11-unix hub.swarmlab.io:5480/swarmlab-codeserver /bin/bash -c "/tmp/start"