添加docker构建运行shell脚本
This commit is contained in:
parent
570448606e
commit
5e707ba38a
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
CONFIG=$1
|
||||||
|
|
||||||
|
if [ -z $CONFIG ]; then
|
||||||
|
echo "Usage: $0 <config file name>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONFIG_ARR=("bj_local" "dev" "local" "test_local")
|
||||||
|
if [[ ! " ${CONFIG_ARR[@]} " =~ " ${CONFIG} " ]]; then
|
||||||
|
echo "Unknown config file name. Usage: $0 <config file name>"
|
||||||
|
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
|
Loading…
Reference in New Issue