mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-05-23 10:05:23 +00:00
更改Dockerfile,每5小时自动拉取最新代码
This commit is contained in:
parent
a744f5e785
commit
c9fb5c6a6a
@ -16,7 +16,8 @@ ARG app_env=prod
|
|||||||
# ARG add_user=www-data
|
# ARG add_user=www-data
|
||||||
|
|
||||||
ENV APP_ENV=${app_env:-"prod"} \
|
ENV APP_ENV=${app_env:-"prod"} \
|
||||||
TIMEZONE=${timezone:-"Asia/Shanghai"}
|
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||||
|
cron="0 10 * * 0"
|
||||||
|
|
||||||
##
|
##
|
||||||
# ---------- building ----------
|
# ---------- building ----------
|
||||||
@ -91,6 +92,7 @@ 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 \
|
||||||
# ---------- 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} \
|
||||||
@ -103,3 +105,5 @@ RUN set -ex \
|
|||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
# VOLUME ["/var/www", "/data"]
|
# VOLUME ["/var/www", "/data"]
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
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"]
|
@ -16,7 +16,8 @@ ARG app_env=prod
|
|||||||
# ARG add_user=www-data
|
# ARG add_user=www-data
|
||||||
|
|
||||||
ENV APP_ENV=${app_env:-"prod"} \
|
ENV APP_ENV=${app_env:-"prod"} \
|
||||||
TIMEZONE=${timezone:-"Asia/Shanghai"}
|
TIMEZONE=${timezone:-"Asia/Shanghai"} \
|
||||||
|
cron="0 10 * * 0"
|
||||||
|
|
||||||
##
|
##
|
||||||
# ---------- building ----------
|
# ---------- building ----------
|
||||||
@ -91,6 +92,7 @@ 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 \
|
||||||
# ---------- 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} \
|
||||||
@ -103,3 +105,5 @@ RUN set -ex \
|
|||||||
EXPOSE 9000
|
EXPOSE 9000
|
||||||
# VOLUME ["/var/www", "/data"]
|
# VOLUME ["/var/www", "/data"]
|
||||||
WORKDIR /var/www
|
WORKDIR /var/www
|
||||||
|
|
||||||
|
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"]
|
@ -20,7 +20,8 @@ RUN set -ex \
|
|||||||
&& apk del --purge *-dev \
|
&& apk del --purge *-dev \
|
||||||
&& 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
|
||||||
|
|
||||||
WORKDIR /IYUU
|
WORKDIR /IYUU
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user