mirror of
https://gitee.com/ledc/IYUUAutoReseed
synced 2025-08-24 06:54:51 +00:00
Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
849370e26a | ||
|
815156b252 | ||
|
d62be67927 | ||
|
d513b1bedf | ||
|
b566181968 | ||
|
60b4939aee | ||
|
dad8afa8d4 | ||
|
a60e5f859c |
24
Dockerfile
24
Dockerfile
@@ -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="3 11 * * *"
|
||||||
|
|
||||||
##
|
##
|
||||||
# ---------- building ----------
|
# ---------- building ----------
|
||||||
@@ -26,7 +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 \
|
||||||
&& 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')
|
||||||
@@ -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} \
|
||||||
@@ -103,8 +106,7 @@ RUN set -ex \
|
|||||||
# && chown -R ${add_user}:${add_user} /data \
|
# && chown -R ${add_user}:${add_user} /data \
|
||||||
&& 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
|
||||||
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
||||||
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"]
|
|
@@ -13,7 +13,7 @@ use IYUU\Library\Table;
|
|||||||
class AutoReseed
|
class AutoReseed
|
||||||
{
|
{
|
||||||
// 版本号
|
// 版本号
|
||||||
const VER = '1.10.12';
|
const VER = '1.10.16';
|
||||||
// RPC连接
|
// RPC连接
|
||||||
private static $links = [];
|
private static $links = [];
|
||||||
// 客户端配置
|
// 客户端配置
|
||||||
@@ -22,10 +22,8 @@ class AutoReseed
|
|||||||
private static $sites = [];
|
private static $sites = [];
|
||||||
// 推荐的合作站点
|
// 推荐的合作站点
|
||||||
private static $recommend = [];
|
private static $recommend = [];
|
||||||
// 不辅种的站点 'pt','hdchina'
|
// 不辅种的站点
|
||||||
private static $noReseed = [];
|
private static $noReseed = [];
|
||||||
// cookie检查
|
|
||||||
private static $cookieCheck = [];
|
|
||||||
// 缓存路径
|
// 缓存路径
|
||||||
public static $cacheDir = TORRENT_PATH.'cache'.DS;
|
public static $cacheDir = TORRENT_PATH.'cache'.DS;
|
||||||
public static $cacheHash = TORRENT_PATH.'cachehash'.DS;
|
public static $cacheHash = TORRENT_PATH.'cachehash'.DS;
|
||||||
@@ -371,7 +369,7 @@ class AutoReseed
|
|||||||
// 初始化
|
// 初始化
|
||||||
if (!empty(self::$sites[$sid]['reseed_check'])) {
|
if (!empty(self::$sites[$sid]['reseed_check'])) {
|
||||||
$reseed_check = explode(',', self::$sites[$sid]['reseed_check']);
|
$reseed_check = explode(',', self::$sites[$sid]['reseed_check']);
|
||||||
array_walk($reseed_check, function (&$v, $k){
|
array_walk($reseed_check, function (&$v, $k) {
|
||||||
$v = trim($v);
|
$v = trim($v);
|
||||||
});
|
});
|
||||||
self::$sites[$sid]['reseed_check'] = $reseed_check;
|
self::$sites[$sid]['reseed_check'] = $reseed_check;
|
||||||
@@ -747,11 +745,6 @@ class AutoReseed
|
|||||||
if (empty($configALL[$siteName]) || empty($configALL[$siteName][$item])) {
|
if (empty($configALL[$siteName]) || empty($configALL[$siteName][$item])) {
|
||||||
$msg = '-------因当前' .$siteName. "站点未设置".$item.",已跳过!!".PHP_EOL.PHP_EOL;
|
$msg = '-------因当前' .$siteName. "站点未设置".$item.",已跳过!!".PHP_EOL.PHP_EOL;
|
||||||
echo $msg;
|
echo $msg;
|
||||||
// 调试代码:begin
|
|
||||||
if ($siteName == 'pthome') {
|
|
||||||
sleepIYUU(10, $msg);
|
|
||||||
}
|
|
||||||
// 调试代码:end
|
|
||||||
self::$wechatMsg['reseedSkip']++;
|
self::$wechatMsg['reseedSkip']++;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -953,15 +946,6 @@ class AutoReseed
|
|||||||
if (empty($configALL[$site]['url_replace'])) {
|
if (empty($configALL[$site]['url_replace'])) {
|
||||||
$configALL[$site]['url_replace'] = array('{passkey}' => trim($configALL[$site]['passkey']));
|
$configALL[$site]['url_replace'] = array('{passkey}' => trim($configALL[$site]['passkey']));
|
||||||
}
|
}
|
||||||
if (empty($configALL[$site]['url_join'])) {
|
|
||||||
$configALL[$site]['url_join'] = array();
|
|
||||||
if (in_array($site, array('m-team','hdbd'))) {
|
|
||||||
if (isset($configALL[$site]['ip_type'])) {
|
|
||||||
$configALL[$site]['url_join'][] = $configALL[$site]['ip_type'].'=1';
|
|
||||||
}
|
|
||||||
$configALL[$site]['url_join'][] = 'https=1';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// 通用操作:替换
|
// 通用操作:替换
|
||||||
if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) {
|
if (isset($configALL[$site]['url_replace']) && $configALL[$site]['url_replace']) {
|
||||||
@@ -987,8 +971,9 @@ class AutoReseed
|
|||||||
$now = time();
|
$now = time();
|
||||||
$uid = isset($configALL[$site]['id']) ? $configALL[$site]['id'] : $now;
|
$uid = isset($configALL[$site]['id']) ? $configALL[$site]['id'] : $now;
|
||||||
$pk = isset($configALL[$site]['passkey']) ? trim($configALL[$site]['passkey']) : $now;
|
$pk = isset($configALL[$site]['passkey']) ? trim($configALL[$site]['passkey']) : $now;
|
||||||
|
$hash = md5(trim($pk));
|
||||||
|
|
||||||
$signString = self::getDownloadTorrentSign($site);
|
$signString = self::getDownloadTorrentSign($site); // 检查签名有效期,如果过期获取新的签名
|
||||||
switch ($site) {
|
switch ($site) {
|
||||||
case 'pthome':
|
case 'pthome':
|
||||||
case 'hdhome':
|
case 'hdhome':
|
||||||
@@ -996,11 +981,11 @@ class AutoReseed
|
|||||||
//兼容性处理:新旧规则
|
//兼容性处理:新旧规则
|
||||||
if (isset($configALL[$site]['rss']) && $configALL[$site]['rss']) {
|
if (isset($configALL[$site]['rss']) && $configALL[$site]['rss']) {
|
||||||
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
||||||
$pk = $configALL[$site]['rss']; // 专用下载hash
|
$hash = $configALL[$site]['rss']; // 直接提交专用下载hash
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'ourbits':
|
case 'ourbits':
|
||||||
// 兼容性处理:新旧规则
|
// 兼容旧版本的IYUU
|
||||||
if (isset($configALL[$site]['id']) && $configALL[$site]['id']) {
|
if (isset($configALL[$site]['id']) && $configALL[$site]['id']) {
|
||||||
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
||||||
}
|
}
|
||||||
@@ -1009,22 +994,28 @@ class AutoReseed
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// 兼容性处理:新旧规则
|
|
||||||
if (isset($configALL[$site]['new']) && $configALL[$site]['new']) {
|
|
||||||
$url = str_replace('passkey={passkey}', 'uid={uid}&hash={hash}', $url);
|
|
||||||
}
|
|
||||||
// 注入替换规则
|
// 注入替换规则
|
||||||
$replace = [
|
$replace = [
|
||||||
'{uid}' => $uid,
|
'{uid}' => $uid,
|
||||||
'{hash}'=> md5(trim($pk)),
|
'{hash}'=> $hash,
|
||||||
'{passkey}' => $pk, // 兼容性处理
|
'{passkey}' => $pk, // 兼容旧版本的IYUU
|
||||||
];
|
];
|
||||||
$configALL[$site]['url_replace'] = $replace;
|
$configALL[$site]['url_replace'] = $replace;
|
||||||
|
|
||||||
// 注入拼接规则
|
// 注入拼接规则
|
||||||
if (empty($configALL[$site]['url_join'])) {
|
if (empty($configALL[$site]['url_join'])) {
|
||||||
$configALL[$site]['url_join'] = array();
|
$configALL[$site]['runtime_url_join'] = []; //保存用户配置规则
|
||||||
|
$configALL[$site]['url_join'] = array($signString);
|
||||||
|
} else {
|
||||||
|
// 用户已配置过url_join 1.先保存用户原来的规则;2.恢复规则;3.注入签名规则
|
||||||
|
if (!isset($configALL[$site]['runtime_url_join'])) {
|
||||||
|
$configALL[$site]['runtime_url_join'] = $configALL[$site]['url_join']; //保存用户配置规则
|
||||||
|
} else {
|
||||||
|
$configALL[$site]['url_join'] = $configALL[$site]['runtime_url_join']; //恢复用户配置规则
|
||||||
|
}
|
||||||
|
$configALL[$site]['url_join'][] = $signString;
|
||||||
}
|
}
|
||||||
$configALL[$site]['url_join'][] = $signString;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $url;
|
return $url;
|
||||||
@@ -1032,6 +1023,7 @@ class AutoReseed
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取下载合作站种子的签名
|
* 获取下载合作站种子的签名
|
||||||
|
* @descr 检查签名有效期,如果过期将获取新的签名
|
||||||
* @param string $site
|
* @param string $site
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
@@ -1050,7 +1042,7 @@ class AutoReseed
|
|||||||
'timestamp' => time(),
|
'timestamp' => time(),
|
||||||
'version' => self::VER,
|
'version' => self::VER,
|
||||||
'site' => $site,
|
'site' => $site,
|
||||||
'uid' => $configALL[$site]['id']
|
'uid' => isset($configALL[$site]['id']) ? $configALL[$site]['id'] : 0,
|
||||||
];
|
];
|
||||||
$res = self::$curl->get(self::$apiUrl . self::$endpoints['getSign'], $data);
|
$res = self::$curl->get(self::$apiUrl . self::$endpoints['getSign'], $data);
|
||||||
$ret = json_decode($res->response, true);
|
$ret = json_decode($res->response, true);
|
||||||
@@ -1063,7 +1055,7 @@ class AutoReseed
|
|||||||
$configALL[$site][$expireKEY] = time() + $expire - 60; // 提前60秒过期
|
$configALL[$site][$expireKEY] = time() + $expire - 60; // 提前60秒过期
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo $site.' 很抱歉,请求IYUU辅种签名时失败啦,请稍后重新尝试辅种!'.PHP_EOL;
|
echo $site.' 很抱歉,请求IYUU辅种签名时失败啦,请稍后重新尝试辅种!详情:'.$ret['msg'].PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $signString;
|
return $signString;
|
||||||
|
@@ -131,6 +131,8 @@ return array(
|
|||||||
'cookie' => '',
|
'cookie' => '',
|
||||||
// 如果需要自动辅种,必须配置
|
// 如果需要自动辅种,必须配置
|
||||||
'passkey' => '',
|
'passkey' => '',
|
||||||
|
// 如果需要辅种,必须配置
|
||||||
|
'rss' => '',
|
||||||
'id' => 0, // 用户ID(不是用户名)
|
'id' => 0, // 用户ID(不是用户名)
|
||||||
'url_replace' => array(),
|
'url_replace' => array(),
|
||||||
'url_join' => array(),
|
'url_join' => array(),
|
||||||
@@ -145,6 +147,8 @@ return array(
|
|||||||
'cookie' => '',
|
'cookie' => '',
|
||||||
// 如果需要自动辅种,必须配置
|
// 如果需要自动辅种,必须配置
|
||||||
'passkey' => '',
|
'passkey' => '',
|
||||||
|
// 如果需要辅种,必须配置
|
||||||
|
'rss' => '',
|
||||||
'id' => 0, // 用户ID(不是用户名)
|
'id' => 0, // 用户ID(不是用户名)
|
||||||
'url_replace' => array(),
|
'url_replace' => array(),
|
||||||
'url_join' => array(),
|
'url_join' => array(),
|
||||||
@@ -159,6 +163,8 @@ return array(
|
|||||||
'cookie' => '',
|
'cookie' => '',
|
||||||
// 如果需要自动辅种,必须配置
|
// 如果需要自动辅种,必须配置
|
||||||
'passkey' => '',
|
'passkey' => '',
|
||||||
|
// 如果需要辅种,必须配置
|
||||||
|
'rss' => '',
|
||||||
'id' => 0, // 用户ID(不是用户名)
|
'id' => 0, // 用户ID(不是用户名)
|
||||||
'url_replace' => array(),
|
'url_replace' => array(),
|
||||||
'url_join' => array(),
|
'url_join' => array(),
|
||||||
|
@@ -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="0 10 * * 0"
|
cron="3 11 * * *"
|
||||||
|
|
||||||
##
|
##
|
||||||
# ---------- building ----------
|
# ---------- building ----------
|
||||||
@@ -27,7 +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 \
|
||||||
&& 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 +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 ----------
|
||||||
@@ -95,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} \
|
||||||
@@ -105,8 +106,7 @@ RUN set -ex \
|
|||||||
# && chown -R ${add_user}:${add_user} /data \
|
# && chown -R ${add_user}:${add_user} /data \
|
||||||
&& 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
|
||||||
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
||||||
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"]
|
|
@@ -1,9 +1,10 @@
|
|||||||
|
# FROM arm64v8/alpine
|
||||||
# FROM arm64v8/alpine:latest
|
# FROM arm64v8/alpine:latest
|
||||||
FROM arm64v8/alpine:3.12
|
FROM arm64v8/alpine:3.12
|
||||||
|
|
||||||
ENV TZ Asia/Shanghai
|
ENV TZ Asia/Shanghai
|
||||||
|
|
||||||
ENV cron="0 9 * * 0"
|
ENV cron="3 15 * * *"
|
||||||
|
|
||||||
RUN set -ex \
|
RUN set -ex \
|
||||||
&& 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 \
|
||||||
@@ -20,8 +21,10 @@ 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 '* * * * * 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 -e "\033[42;37m Build Completed :).\033[0m\n"
|
||||||
|
|
||||||
WORKDIR /IYUU
|
WORKDIR /IYUU
|
||||||
|
ENTRYPOINT ["/IYUU/docker/entrypoint.sh"]
|
||||||
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"]
|
|
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
|
Reference in New Issue
Block a user