mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-19 16:05:21 +00:00
优化docker
This commit is contained in:
parent
815156b252
commit
849370e26a
@ -96,7 +96,7 @@ RUN set -ex \
|
|||||||
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||||
&& echo "${TIMEZONE}" > /etc/timezone \
|
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||||
&& echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
&& 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 ----------
|
# ---------- some config work ----------
|
||||||
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
||||||
# && addgroup -g 82 -S ${add_user} \
|
# && addgroup -g 82 -S ${add_user} \
|
||||||
@ -109,5 +109,4 @@ RUN set -ex \
|
|||||||
# EXPOSE 9000
|
# EXPOSE 9000
|
||||||
# VOLUME ["/IYUU", "/data"]
|
# VOLUME ["/IYUU", "/data"]
|
||||||
WORKDIR /IYUU
|
WORKDIR /IYUU
|
||||||
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
||||||
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]
|
|
@ -13,7 +13,7 @@ use IYUU\Library\Table;
|
|||||||
class AutoReseed
|
class AutoReseed
|
||||||
{
|
{
|
||||||
// 版本号
|
// 版本号
|
||||||
const VER = '1.10.15';
|
const VER = '1.10.16';
|
||||||
// RPC连接
|
// RPC连接
|
||||||
private static $links = [];
|
private static $links = [];
|
||||||
// 客户端配置
|
// 客户端配置
|
||||||
|
@ -19,7 +19,7 @@ ARG app_env=prod
|
|||||||
|
|
||||||
ENV APP_ENV=${app_env:-"prod"} \
|
ENV APP_ENV=${app_env:-"prod"} \
|
||||||
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||||
cron="8 14 * * *"
|
cron="3 11 * * *"
|
||||||
|
|
||||||
##
|
##
|
||||||
# ---------- building ----------
|
# ---------- building ----------
|
||||||
@ -27,8 +27,7 @@ ENV APP_ENV=${app_env:-"prod"} \
|
|||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
# change apk source repo
|
# 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.ustc.edu.cn/' /etc/apk/repositories \
|
||||||
# && sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.cn/' /etc/apk/repositories \
|
|
||||||
&& apk update \
|
&& apk update \
|
||||||
&& apk add --no-cache \
|
&& apk add --no-cache \
|
||||||
# Install base packages ('ca-certificates' will install 'nghttp2-libs')
|
# Install base packages ('ca-certificates' will install 'nghttp2-libs')
|
||||||
@ -47,7 +46,7 @@ RUN set -ex \
|
|||||||
# php7-common \
|
# php7-common \
|
||||||
# php7-bcmath \
|
# php7-bcmath \
|
||||||
php7-curl \
|
php7-curl \
|
||||||
# php7-ctype \
|
# php7-ctype \
|
||||||
php7-dom \
|
php7-dom \
|
||||||
# php7-fileinfo \
|
# php7-fileinfo \
|
||||||
# php7-gettext \
|
# php7-gettext \
|
||||||
@ -78,7 +77,7 @@ RUN set -ex \
|
|||||||
# php7-tokenizer \
|
# php7-tokenizer \
|
||||||
php7-zip \
|
php7-zip \
|
||||||
# php7-zlib \
|
# php7-zlib \
|
||||||
php7-xml \
|
php7-xml \
|
||||||
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
|
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
|
||||||
&& cp /IYUU/config/config.sample.php /IYUU/config/config.php \
|
&& cp /IYUU/config/config.sample.php /IYUU/config/config.php \
|
||||||
&& ln -sf /IYUU/config/config.php /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 \
|
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
|
||||||
&& echo "${TIMEZONE}" > /etc/timezone \
|
&& echo "${TIMEZONE}" > /etc/timezone \
|
||||||
&& echo '2 */5 * * * cd /IYUU && git fetch --all && git reset --hard origin/master' >> /etc/crontabs/root \
|
&& 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 ----------
|
# ---------- some config work ----------
|
||||||
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
# - ensure 'www-data' user exists(82 is the standard uid/gid for "www-data" in Alpine)
|
||||||
# && addgroup -g 82 -S ${add_user} \
|
# && addgroup -g 82 -S ${add_user} \
|
||||||
@ -110,5 +109,4 @@ RUN set -ex \
|
|||||||
# EXPOSE 9000
|
# EXPOSE 9000
|
||||||
# VOLUME ["/IYUU", "/data"]
|
# VOLUME ["/IYUU", "/data"]
|
||||||
WORKDIR /IYUU
|
WORKDIR /IYUU
|
||||||
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
||||||
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]
|
|
@ -23,7 +23,8 @@ RUN set -ex \
|
|||||||
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
|
||||||
# && echo '* * * * * echo "iyuu.cn" >/dev/null 2>&1' >> /etc/crontabs/root \
|
# && 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 '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
|
WORKDIR /IYUU
|
||||||
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
7
docker/entrypoint.sh
Normal file
7
docker/entrypoint.sh
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user