Skip to content

Commit 25add27

Browse files
5aaee9Anankke
authored andcommitted
feat: add docker support
1 parent ad9fbc4 commit 25add27

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.git
2+
uim-index-dev/

Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM indexyz/php
2+
LABEL maintainer="Indexyz <indexyz@protonmail.com>"
3+
4+
COPY . /var/www
5+
WORKDIR /var/www
6+
7+
RUN cp config/.config.example.php config/.config.php && \
8+
chmod -R 755 storage && \
9+
chmod -R 777 /var/www/storage/framework/smarty/compile/ && \
10+
curl -SL https://getcomposer.org/installer -o composer-setup.php && \
11+
php composer-setup.php && \
12+
php composer.phar install && \
13+
php xcat initQQWry && \
14+
php xcat initdownload && \
15+
crontab -l | { cat; echo "30 22 * * * php /var/www/xcat sendDiaryMail"; } | crontab - && \
16+
crontab -l | { cat; echo "0 0 * * * php /var/www/xcat dailyjob"; } | crontab - && \
17+
crontab -l | { cat; echo "*/1 * * * * php /var/www/xcat checkjob"; } | crontab - && \
18+
crontab -l | { cat; echo "*/1 * * * * php /var/www/xcat syncnode"; } | crontab - && \
19+
{ \
20+
echo '[program:crond]'; \
21+
echo 'command=cron -f'; \
22+
echo 'autostart=true'; \
23+
echo 'autorestart=true'; \
24+
echo 'killasgroup=true'; \
25+
echo 'stopasgroup=true'; \
26+
} | tee /etc/supervisor/crond.conf

config/.config.example.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218

219219
#PayJs
220220
$System_Config['payjs_mchid']='';
221-
$System_Config['payjs_key']='';
221+
$System_Config['payjs_key']='';
222222

223223

224224
//其他面板显示设置------------------------------------------------------------------------------------------
@@ -324,3 +324,30 @@
324324
$list = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
325325
$_SERVER['REMOTE_ADDR'] = $list[0];
326326
}
327+
328+
329+
// make replace System_Config with env
330+
function findKeyName($name) {
331+
global $System_Config;
332+
foreach($System_Config as $configKey => $configValue) {
333+
if (strtoupper($configKey) == $name) {
334+
return $configKey;
335+
}
336+
}
337+
338+
return NULL;
339+
}
340+
341+
foreach(getenv() as $envKey => $envValue) {
342+
global $System_Config;
343+
$envUpKey = strtoupper($envKey);
344+
// Key starts with UIM_
345+
if (substr($envUpKey, 0 , 4) == "UIM_") {
346+
// Vaild env key, set to System_Config
347+
$configKey = substr($envUpKey, 4);
348+
$realKey = findKeyName($configKey);
349+
if ($realKey != NULL) {
350+
$System_Config[$realKey] = $envValue;
351+
}
352+
}
353+
}

0 commit comments

Comments
 (0)