修改 Dockerfile

This commit is contained in:
david 2020-12-14 02:36:38 +08:00
parent b566181968
commit d513b1bedf
4 changed files with 29 additions and 22 deletions

View File

@ -1,4 +1,5 @@
#FROM alpine:latest #FROM alpine:latest
#FROM alpine:3.12
FROM alpine:3.8 FROM alpine:3.8
#FROM swoft/alphp:base #FROM swoft/alphp:base
#FROM swoft/alphp:cli #FROM swoft/alphp:cli
@ -18,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="9 11 * * 0" cron="0 10 * * 0"
## ##
# ---------- building ---------- # ---------- building ----------
@ -62,6 +63,7 @@ RUN set -ex \
# php7-pdo_mysql \ # php7-pdo_mysql \
# php7-pdo_sqlite \ # php7-pdo_sqlite \
# php7-phar \ # php7-phar \
# php7-pcntl \
# php7-posix \ # php7-posix \
# php7-redis \ # php7-redis \
php7-simplexml \ php7-simplexml \
@ -76,9 +78,9 @@ RUN set -ex \
php7-zip \ php7-zip \
# php7-zlib \ # php7-zlib \
php7-xml \ php7-xml \
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /var/www \ && git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
&& cp /var/www/config/config.sample.php /var/www/config/config.php \ && cp /IYUU/config/config.sample.php /IYUU/config/config.php \
&& ln -sf /var/www/config/config.php /config.php \ && ln -sf /IYUU/config/config.php /config.php \
&& apk del --purge *-dev \ && apk del --purge *-dev \
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \ && rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \
# ---------- some config,clear work ---------- # ---------- some config,clear work ----------
@ -93,7 +95,8 @@ RUN set -ex \
# - config timezone # - config timezone
&& 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 /var/www && 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 \
# ---------- 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} \
@ -104,7 +107,7 @@ RUN set -ex \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n" && echo -e "\033[42;37m Build Completed :).\033[0m\n"
EXPOSE 9000 EXPOSE 9000
# VOLUME ["/var/www", "/data"] # VOLUME ["/IYUU", "/data"]
WORKDIR /var/www WORKDIR /IYUU
CMD ["sh", "-c", "/usr/bin/php /var/www/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /var/www/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"] CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]

View File

@ -13,7 +13,7 @@ use IYUU\Library\Table;
class AutoReseed class AutoReseed
{ {
// 版本号 // 版本号
const VER = '1.10.13'; const VER = '1.10.14';
// RPC连接 // RPC连接
private static $links = []; private static $links = [];
// 客户端配置 // 客户端配置

View File

@ -28,6 +28,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')
@ -78,9 +79,9 @@ RUN set -ex \
php7-zip \ php7-zip \
# php7-zlib \ # php7-zlib \
php7-xml \ php7-xml \
&& git clone https://gitee.com/ledc/IYUUAutoReseed.git /var/www \ && git clone https://gitee.com/ledc/IYUUAutoReseed.git /IYUU \
&& cp /var/www/config/config.sample.php /var/www/config/config.php \ && cp /IYUU/config/config.sample.php /IYUU/config/config.php \
&& ln -sf /var/www/config/config.php /config.php \ && ln -sf /IYUU/config/config.php /config.php \
&& apk del --purge *-dev \ && apk del --purge *-dev \
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \ && rm -rf /var/cache/apk/* /tmp/* /usr/share/man /usr/share/php7 \
# ---------- some config,clear work ---------- # ---------- some config,clear work ----------
@ -95,7 +96,8 @@ RUN set -ex \
# - config timezone # - config timezone
&& 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 /var/www && 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 \
# ---------- 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} \
@ -106,7 +108,7 @@ RUN set -ex \
&& echo -e "\033[42;37m Build Completed :).\033[0m\n" && echo -e "\033[42;37m Build Completed :).\033[0m\n"
EXPOSE 9000 EXPOSE 9000
# VOLUME ["/var/www", "/data"] # VOLUME ["/IYUU", "/data"]
WORKDIR /var/www WORKDIR /IYUU
CMD ["sh", "-c", "/usr/bin/php /var/www/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /var/www/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"] CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]

View File

@ -1,3 +1,4 @@
# FROM arm64v8/alpine
# FROM arm64v8/alpine:latest # FROM arm64v8/alpine:latest
FROM arm64v8/alpine:3.12 FROM arm64v8/alpine:3.12
@ -20,8 +21,9 @@ RUN set -ex \
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \ && rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
&& echo "${TZ}" > /etc/timezone \ && echo "${TZ}" > /etc/timezone \
&& ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \ && ln -sf /usr/share/zoneinfo/${TZ} /etc/localtime \
&& echo '2 */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 '* * * * * echo "iyuu.cn" >/dev/null 2>&1' >> /etc/crontabs/root
WORKDIR /IYUU WORKDIR /IYUU
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php; /usr/sbin/crond; tail -f /dev/null"]
CMD ["sh", "-c", "/usr/bin/php /IYUU/iyuu.php ; /usr/sbin/crond ; (crontab -l ;echo \"$cron /usr/bin/php /IYUU/iyuu.php &> /dev/null\") | crontab - ; tail -f /dev/null"]