添加dockerfile

This commit is contained in:
whyour
2021-03-18 10:02:13 +08:00
parent 361963711e
commit 4555a24434
13 changed files with 1026 additions and 191 deletions
+59
View File
@@ -0,0 +1,59 @@
#!/bin/bash
set -e
echo -e "======================1. 检测配置文件========================\n"
[ ! -d ${JD_DIR}/config ] && mkdir -p ${JD_DIR}/config
if [ ! -s ${JD_DIR}/config/crontab.list ]
then
echo -e "检测到config配置目录下不存在crontab.list或存在但文件为空,从示例文件复制一份用于初始化...\n"
cp -fv ${JD_DIR}/sample/crontab.list.sample ${JD_DIR}/config/crontab.list
sed -i "s,MY_PATH,${JD_DIR},g" ${JD_DIR}/config/crontab.list
sed -i "s,ENV_PATH=,PATH=$PATH,g" ${JD_DIR}/config/crontab.list
fi
crond
crontab ${JD_DIR}/config/crontab.list
echo -e "成功添加定时任务...\n"
if [ ! -s ${JD_DIR}/config/config.sh ]; then
echo -e "检测到config配置目录下不存在config.sh,从示例文件复制一份用于初始化...\n"
cp -fv ${JD_DIR}/sample/config.sh.sample ${JD_DIR}/config/config.sh
echo
fi
if [ ! -s ${JD_DIR}/config/auth.json ]; then
echo -e "检测到config配置目录下不存在auth.json,从示例文件复制一份用于初始化...\n"
cp -fv ${JD_DIR}/sample/auth.json ${JD_DIR}/config/auth.json
echo
fi
if [ ! -s /etc/nginx/conf.d/front.conf ]
then
echo -e "检测到nginx配置不存在...\n"
cp -fv ${JD_DIR}/docker/front.conf /etc/nginx/conf.d/front.conf
fi
echo -e "======================2. 更新源代码========================\n"
bash ${JD_DIR}/git_pull.sh
echo
echo -e "======================4. 启动挂机程序========================\n"
. ${JD_DIR}/config/config.sh
if [ -n "${Cookie1}" ]; then
bash ${JD_DIR}/jd.sh hangup 2>/dev/null
echo -e "挂机程序启动成功...\n"
else
echo -e "config.sh中还未填入有效的Cookie,可能是首次部署容器,因此不启动挂机程序...\n"
fi
echo -e "======================5. 启动控制面板========================\n"
pm2 start ${JD_DIR}/build/app.js
echo -e "控制面板启动成功...\n"
echo -e "\n容器启动成功...\n"
if [ "${1#-}" != "${1}" ] || [ -z "$(command -v "${1}")" ]; then
set -- node "$@"
fi
exec "$@"