diff --git a/docker_build_run.sh b/docker_build_run.sh new file mode 100644 index 0000000..a25a4ac --- /dev/null +++ b/docker_build_run.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +CONFIG=$1 + +if [ -z $CONFIG ]; then + echo "Usage: $0 " + exit 1 +fi + +CONFIG_ARR=("bj_local" "dev" "local" "test_local") +if [[ ! " ${CONFIG_ARR[@]} " =~ " ${CONFIG} " ]]; then + echo "Unknown config file name. Usage: $0 " + exit 1 +fi + +# 创建docker网络mynet函数 +create_docker_mynet() { + docker_net=$(docker network list | grep mynet) + echo ${docker_net} + if [ "${docker_net}" ];then + echo "docker network mynet exists" + else + docker network create --driver bridge --subnet 192.168.53.0/24 --gateway 192.168.53.1 mynet + fi +} +# 执行docker网络mynet创建 +create_docker_mynet + +docker rmi -f bj-rtsts-server +docker build --rm=true -f ./Dockerfile -t bj-rtsts-server:1.0 ./ + +docker run --name bj-rtsts-server --restart=always --network mynet --ip 192.168.53.191 -d -p 9091:9091 -v /usr/local/joylink/logs/bjrtsts:/logs/bjrtsts bj-rtsts-server:1.0 bj-rtsts-server -config $CONFIG