22 lines
559 B
Bash
Executable File
22 lines
559 B
Bash
Executable File
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
source docker.conf
|
|
export WORKERMAN_CONTAINER_NAME=$container_name
|
|
export WORKERMAN_IMAGE_VERSION=$image_version
|
|
|
|
# 判断容器是否存在
|
|
if [ ! "$(docker ps -a -q -f name=$WORKERMAN_CONTAINER_NAME)" ]; then
|
|
# 调用init脚本
|
|
./init
|
|
fi
|
|
|
|
# 判断容器是否在运行
|
|
if [ ! "$(docker inspect -f {{.State.Running}} $WORKERMAN_CONTAINER_NAME)" = "true" ]; then
|
|
# 启动容器
|
|
docker start $WORKERMAN_CONTAINER_NAME
|
|
fi
|
|
|
|
# 进入容器并执行composer命令
|
|
docker exec -it $WORKERMAN_CONTAINER_NAME bash -c "composer $*" |