docker-webman-jsonrpc/init
2023-11-11 13:48:58 +08:00

31 lines
940 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -e
source docker.conf
export WORKERMAN_CONTAINER_NAME=$container_name
export WORKERMAN_IMAGE_VERSION=$image_version
# 判断.env文件是否存在
if [ ! -f .env ]; then
# 如果.env.example文件存在则通过cp命令生成.env文件
if [ -f .env.example ]; then
cp .env.example .env
echo ".env file created from .env.example"
else
echo "Error: .env file does not exist and .env.example file also does not exist"
exit 1
fi
fi
# 判断容器是否存在
if [ "$(docker ps -a -q -f name=$WORKERMAN_CONTAINER_NAME)" ]; then
echo "Container $WORKERMAN_CONTAINER_NAME already exists. Please delete it before installing. Or user $(tput bold)./server <action>$(tput sgr0) to control it."
exit 1
fi
# 启动容器
docker compose -f docker-compose.yml up -d
# 进入容器并执行composer install
docker exec -it $WORKERMAN_CONTAINER_NAME bash -c "composer install"