Spaces:
Running
Running
File size: 967 Bytes
8f3f8db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
#!/bin/bash
lively_dir="$PWD/LivelyKernel"
squeakjs_dir=`dirname $PWD`
container_name="squeakjs-lively"
# if no docker image, build it
docker image inspect $container_name > /dev/null 2>&1
if [[ $? -ne 0 ]] ; then
echo "Building docker image"
docker build --rm -t $container_name .
fi
mkdir -p $lively_dir
# if the lively dir is empty first install it
dir_content=`ls -A "$lively_dir" 2>/dev/null`
if [[ -z $dir_content ]]; then
pushd $lively_dir;
branch=${git_branch-master}
git clone --branch $branch --single-branch https://github.com/LivelyKernel/LivelyKernel .
popd
fi
shutdown() {
echo "Stopping container..."
docker ps --filter "ancestor=$container_name" -q | xargs docker stop
}
trap shutdown SIGTERM SIGKILL SIGINT
echo "Starting docker"
docker run --rm -ti \
-v $lively_dir:/home/lively/LivelyKernel \
-v $squeakjs_dir:/home/lively/LivelyKernel/users/SqueakJS \
-p 9001-9004:9001-9004 \
-t $container_name
|