Skip to content

Commit

Permalink
更改Dockerfile,每5小时自动拉取最新代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ledccn committed Jul 31, 2020
1 parent a744f5e commit c9fb5c6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ ARG app_env=prod
# ARG add_user=www-data

ENV APP_ENV=${app_env:-"prod"} \
TIMEZONE=${timezone:-"Asia/Shanghai"}
TIMEZONE=${timezone:-"Asia/Shanghai"} \
cron="0 10 * * 0"

##
# ---------- building ----------
Expand Down Expand Up @@ -91,6 +92,7 @@ RUN set -ex \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& echo '2 */5 * * * cd /var/www && git fetch --all && git reset --hard origin/master' >> /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} \
Expand All @@ -103,3 +105,5 @@ RUN set -ex \
EXPOSE 9000
# VOLUME ["/var/www", "/data"]
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"]
6 changes: 5 additions & 1 deletion docker/AMD64/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ ARG app_env=prod
# ARG add_user=www-data

ENV APP_ENV=${app_env:-"prod"} \
TIMEZONE=${timezone:-"Asia/Shanghai"}
TIMEZONE=${timezone:-"Asia/Shanghai"} \
cron="0 10 * * 0"

##
# ---------- building ----------
Expand Down Expand Up @@ -91,6 +92,7 @@ RUN set -ex \
# - config timezone
&& ln -sf /usr/share/zoneinfo/${TIMEZONE} /etc/localtime \
&& echo "${TIMEZONE}" > /etc/timezone \
&& echo '2 */5 * * * cd /var/www && git fetch --all && git reset --hard origin/master' >> /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} \
Expand All @@ -103,3 +105,5 @@ RUN set -ex \
EXPOSE 9000
# VOLUME ["/var/www", "/data"]
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"]
3 changes: 2 additions & 1 deletion docker/Arm64v8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ RUN set -ex \
&& apk del --purge *-dev \
&& rm -rf /var/cache/apk/* /tmp/* /usr/share/man \
&& 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

Expand Down

0 comments on commit c9fb5c6

Please sign in to comment.