feat: add docker support

no_ymq_dev
Indexyz 7 years ago committed by Anankke
parent ad9fbc456a
commit 25add275e7

@ -0,0 +1,2 @@
.git
uim-index-dev/

@ -0,0 +1,26 @@
FROM indexyz/php
LABEL maintainer="Indexyz <indexyz@protonmail.com>"
COPY . /var/www
WORKDIR /var/www
RUN cp config/.config.example.php config/.config.php && \
chmod -R 755 storage && \
chmod -R 777 /var/www/storage/framework/smarty/compile/ && \
curl -SL https://getcomposer.org/installer -o composer-setup.php && \
php composer-setup.php && \
php composer.phar install && \
php xcat initQQWry && \
php xcat initdownload && \
crontab -l | { cat; echo "30 22 * * * php /var/www/xcat sendDiaryMail"; } | crontab - && \
crontab -l | { cat; echo "0 0 * * * php /var/www/xcat dailyjob"; } | crontab - && \
crontab -l | { cat; echo "*/1 * * * * php /var/www/xcat checkjob"; } | crontab - && \
crontab -l | { cat; echo "*/1 * * * * php /var/www/xcat syncnode"; } | crontab - && \
{ \
echo '[program:crond]'; \
echo 'command=cron -f'; \
echo 'autostart=true'; \
echo 'autorestart=true'; \
echo 'killasgroup=true'; \
echo 'stopasgroup=true'; \
} | tee /etc/supervisor/crond.conf

@ -218,7 +218,7 @@ $System_Config['bitpay_secret']='';
#PayJs
$System_Config['payjs_mchid']='';
$System_Config['payjs_key']='';
$System_Config['payjs_key']='';
//其他面板显示设置------------------------------------------------------------------------------------------
@ -324,3 +324,30 @@ if ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) {
$list = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$_SERVER['REMOTE_ADDR'] = $list[0];
}
// make replace System_Config with env
function findKeyName($name) {
global $System_Config;
foreach($System_Config as $configKey => $configValue) {
if (strtoupper($configKey) == $name) {
return $configKey;
}
}
return NULL;
}
foreach(getenv() as $envKey => $envValue) {
global $System_Config;
$envUpKey = strtoupper($envKey);
// Key starts with UIM_
if (substr($envUpKey, 0 , 4) == "UIM_") {
// Vaild env key, set to System_Config
$configKey = substr($envUpKey, 4);
$realKey = findKeyName($configKey);
if ($realKey != NULL) {
$System_Config[$realKey] = $envValue;
}
}
}

Loading…
Cancel
Save