From 849370e26ae44827de673b35cf6f8d914fdc1a20 Mon Sep 17 00:00:00 2001 From: david Date: Tue, 22 Dec 2020 00:14:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96docker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 5 ++--- app/AutoReseed.php | 2 +- docker/AMD64/Dockerfile | 14 ++++++-------- docker/Arm64v8/Dockerfile | 5 +++-- docker/entrypoint.sh | 7 +++++++ docker/{Arm64v8 => }/iyuu.sh | 0 6 files changed, 19 insertions(+), 14 deletions(-) create mode 100644 docker/entrypoint.sh rename docker/{Arm64v8 => }/iyuu.sh (100%) diff --git a/Dockerfile b/Dockerfile index 5a7db4c..b1b8d4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -96,7 +96,7 @@ RUN set -ex \ && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \ && echo "${TIMEZONE}" > /etc/timezone \ && echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \ - && echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \ + #&& echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \ # ---------- some config work ---------- # - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine) # && addgroup -g 82 -S ${add_user} \ @@ -109,5 +109,4 @@ RUN set -ex \ # EXPOSE 9000 # VOLUME ["/IYUU", "/data"] WORKDIR /IYUU - -CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"] \ No newline at end of file +ENTRYPOINT ["/IYUU/docker/entrypoint.sh"] \ No newline at end of file diff --git a/app/AutoReseed.php b/app/AutoReseed.php index 26bdfc3..7558054 100644 --- a/app/AutoReseed.php +++ b/app/AutoReseed.php @@ -13,7 +13,7 @@ use IYUU\Library\Table; class AutoReseed { // 版本号 - const VER = '1.10.15'; + const VER = '1.10.16'; // RPC连接 private static $links = []; // 客户端配置 diff --git a/docker/AMD64/Dockerfile b/docker/AMD64/Dockerfile index 54b6996..b1b8d4f 100644 --- a/docker/AMD64/Dockerfile +++ b/docker/AMD64/Dockerfile @@ -19,7 +19,7 @@ ARG app_env=prod ENV APP_ENV=${app_env:-"prod"} \ TIMEZONE=${timezone:-"Asia/Shanghai"} \ - cron="8 14 * * *" + cron="3 11 * * *" ## # ---------- building ---------- @@ -27,8 +27,7 @@ ENV APP_ENV=${app_env:-"prod"} \ RUN set -ex \ # change apk source repo - && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \ - # && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.cn/' /etc/apk/repositories \ + #&& sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/' /etc/apk/repositories \ && apk update \ && apk add --no-cache \ # Install base packages ('ca-certificates' will install 'nghttp2-libs') @@ -47,7 +46,7 @@ RUN set -ex \ # php7-common \ # php7-bcmath \ php7-curl \ - # php7-ctype \ + # php7-ctype \ php7-dom \ # php7-fileinfo \ # php7-gettext \ @@ -78,7 +77,7 @@ RUN set -ex \ # php7-tokenizer \ php7-zip \ # php7-zlib \ - php7-xml \ + php7-xml \ && git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \ && cp /IYUU/config/config.sample.php /IYUU/config/config.php \ && ln -sf /IYUU/config/config.php /config.php \ @@ -97,7 +96,7 @@ RUN set -ex \ && ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \ && echo "${TIMEZONE}" > /etc/timezone \ && echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \ - && echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \ + #&& echo "${cron} /usr/bin/php /IYUU/iyuu.php &> /dev/null" >> /etc/crontabs/root \ # ---------- some config work ---------- # - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine) # && addgroup -g 82 -S ${add_user} \ @@ -110,5 +109,4 @@ RUN set -ex \ # EXPOSE 9000 # VOLUME ["/IYUU", "/data"] WORKDIR /IYUU - -CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"] \ No newline at end of file +ENTRYPOINT ["/IYUU/docker/entrypoint.sh"] \ No newline at end of file diff --git a/docker/Arm64v8/Dockerfile b/docker/Arm64v8/Dockerfile index 9505378..60c323c 100644 --- a/docker/Arm64v8/Dockerfile +++ b/docker/Arm64v8/Dockerfile @@ -23,7 +23,8 @@ RUN set -ex \ && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ # && echo '* * * * * echo "iyuu.cn" >/dev/null 2>&1' >> /etc/crontabs/root \ && echo '3 */6 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \ - && echo "${cron} /usr/bin/php /IYUU/iyuu.php >/dev/null 2>&1" >> /etc/crontabs/root + # && echo "${cron} /usr/bin/php /IYUU/iyuu.php >/dev/null 2>&1" >> /etc/crontabs/root \ + && echo -e "\033[42;37m Build Completed :).\033[0m\n" WORKDIR /IYUU -CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"] \ No newline at end of file +ENTRYPOINT ["/IYUU/docker/entrypoint.sh"] \ No newline at end of file diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..dbd22f9 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/sh +DEFAULT_CRON="9 */6 * * *" +cron=${cron:-$DEFAULT_CRON} +set -e +echo "$cron /usr/bin/php /IYUU/iyuu.php" | crontab - +/usr/bin/php /IYUU/iyuu.php +/usr/sbin/crond -f diff --git a/docker/Arm64v8/iyuu.sh b/docker/iyuu.sh similarity index 100% rename from docker/Arm64v8/iyuu.sh rename to docker/iyuu.sh