Add docker related files
This commit is contained in:
45
_web_server/container-run.sh
Executable file
45
_web_server/container-run.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ 0 -eq "$#" ]; then
|
||||
echo "Usage $0 start/stop/status"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
action=$1
|
||||
container=playground
|
||||
|
||||
case $action in
|
||||
"start")
|
||||
cid=$(docker container ls -q -a -f name=$container)
|
||||
|
||||
if [ -z "$cid" ]; then
|
||||
docker run -d --name $container \
|
||||
-p 127.0.0.1:8089:8080 \
|
||||
-v /srv/playground/storage:/verilog-playground-store \
|
||||
--cpus=1 --memory=16g --memory-swap=16g \
|
||||
$container
|
||||
else
|
||||
docker start $container
|
||||
fi
|
||||
;;
|
||||
|
||||
"stop")
|
||||
# Press twice CRTL-C
|
||||
docker kill -s SIGINT $container
|
||||
docker kill -s SIGINT $container
|
||||
;;
|
||||
|
||||
"status")
|
||||
cid=$(docker container ls -q -f name=$container)
|
||||
|
||||
if [ -z "$cid" ]; then
|
||||
echo "Stopped"
|
||||
else
|
||||
echo "Started"
|
||||
fi
|
||||
;;
|
||||
|
||||
"*")
|
||||
echo "Unknown action $action. Actions start, stop and status are allowed"
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user