dailycheckin/docker_start.sh
2021-05-21 15:18:47 +08:00

34 lines
1.2 KiB
Bash
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
echo "在当前目录下创建 config 文件夹"
mkdir -p config
echo "下载渲染 config 文件的脚本,并执行渲染"
curl https://gitee.com/sitoi/dailycheckin/raw/main/docker/config.template.json -o config/config.json
docker --version
if [ $? -ne 0 ];then
echo "未安装 docker ,请先安装 docker 再运行脚本。"
else
echo "docker 环境存在,检测 docker-compose 环境是否安装..."
docker-compose --version
if [ $? -ne 0 ];then
echo "未安装 docker-compose将使用 docker 命令启动容器..."
echo "开始通过 docker 命令创建容器"
docker run -d -v $(pwd)/config:/dailycheckin/config \
-v $(pwd)/logs:/dailycheckin/logs \
--name dailycheckin \
--restart always \
sitoi/dailycheckin:latest
else
echo "docker-compose 环境存在,将使用 docker-compose 命令启动容器..."
echo "下载 docker-compose.yml 文件"
curl -O https://gitee.com/sitoi/dailycheckin/raw/main/docker/docker-compose.yml
echo "下载 Makefile 文件(可以无视)"
curl -O https://gitee.com/sitoi/dailycheckin/raw/main/docker/Makefile
echo "开始通过 docker-compose 命令创建容器"
docker-compose up -d
fi
fi