diff --git a/docker/Dockerfile b/docker/Dockerfile index 293df509..2796a620 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,4 +39,4 @@ RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && yarn build-back \ && yarn install --production --network-timeout 100000 \ && yarn cache clean -ENTRYPOINT ["./docker-entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["./docker/docker-entrypoint.sh"] \ No newline at end of file diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index fdf88e58..99257258 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -2,7 +2,7 @@ set -e echo -e "======================1. 初始化命令========================\n" -dir_shell=$(dirname $(readlink -f "$0")) +dir_shell=/ql/shell/ dir_root=$( cd $dir_shell cd .. @@ -22,35 +22,7 @@ ql update echo echo -e "======================3. 检测配置文件========================\n" -[ ! -d ${QL_DIR}/config ] && mkdir -p ${QL_DIR}/config -[ ! -d ${QL_DIR}/log ] && mkdir -p ${QL_DIR}/log -[ ! -d ${QL_DIR}/db ] && mkdir -p ${QL_DIR}/db -[ ! -d ${QL_DIR}/manual_log ] && mkdir -p ${QL_DIR}/manual_log - -if [ ! -s ${QL_DIR}/config/cookie.sh ]; then - echo -e "检测到config配置目录下不存在cookie.sh,从示例文件复制一份用于初始化...\n" - touch ${QL_DIR}/config/cookie.sh - echo -fi - -if [ ! -s ${QL_DIR}/config/config.sh ]; then - echo -e "检测到config配置目录下不存在config.sh,从示例文件复制一份用于初始化...\n" - cp -fv ${QL_DIR}/sample/config.sample.sh ${QL_DIR}/config/config.sh - echo -fi - -if [ ! -s ${QL_DIR}/config/auth.sample.json ]; then - echo -e "检测到config配置目录下不存在auth.json,从示例文件复制一份用于初始化...\n" - cp -fv ${QL_DIR}/sample/auth.sample.json ${QL_DIR}/config/auth.json - echo -fi - -if [ -s /etc/nginx/conf.d/default.conf ]; then - echo -e "检测到默认nginx配置文件,删除...\n" - rm -f /etc/nginx/conf.d/default.conf - echo -fi - +fix_config cp -fv ${QL_DIR}/docker/front.conf /etc/nginx/conf.d/front.conf echo -e "======================4. 启动nginx========================\n" diff --git a/shell/share.sh b/shell/share.sh index 9661ce07..44d92348 100755 --- a/shell/share.sh +++ b/shell/share.sh @@ -5,6 +5,8 @@ dir_scripts=$dir_root/scripts dir_repo=$dir_root/repo dir_raw=$dir_scripts/raw dir_log=$dir_root/log +dir_db=$dir_root/db +dir_manual_log=$dir_root/manual_log dir_list_tmp=$dir_log/.tmp ## 文件 @@ -143,9 +145,31 @@ define_cmd () { ## 修复配置文件 fix_config () { make_dir $dir_config + make_dir $dir_log + make_dir $dir_db + make_dir $dir_manual_log + if [ ! -s $file_config_user ]; then echo -e "复制一份 $file_config_sample 为 $file_config_user,随后请按注释编辑你的配置文件:$file_config_user\n" cp -fv $file_config_sample $file_config_user echo fi + + if [ ! -s $file_cookie ]; then + echo -e "检测到config配置目录下不存在cookie.sh,创建一个空文件用于初始化...\n" + touch $file_cookie + echo + fi + + if [ ! -s $file_auth_user ]; then + echo -e "复制一份 $file_auth_sample 为 $file_auth_user\n" + cp -fv $file_auth_sample $file_auth_user + echo + fi + + if [ -s /etc/nginx/conf.d/default.conf ]; then + echo -e "检测到默认nginx配置文件,删除...\n" + rm -f /etc/nginx/conf.d/default.conf + echo + fi }