[TASK] add structure for docker configuration

For now only one option is available: FILE_HASH
You can run Jirafeau's docker with -e FILE_HASH="random" to disable file hashing.

ref #146

Signed-off-by: Jerome Jutteau <jerome@jutteau.fr>
This commit is contained in:
Jerome Jutteau 2020-12-13 21:08:34 +01:00
parent c6c5eb250b
commit 36e0d29e64
4 changed files with 43 additions and 1 deletions

View File

@ -19,6 +19,7 @@ COPY .git .git
RUN apk add git && \
git reset --hard && rm -rf docker .git .gitignore .gitlab-ci.yml CONTRIBUTING.md Dockerfile README.md && \
apk del git && \
touch /www/lib/config.local.php && \
chown -R $USER_UID.$GROUP_UID /www && \
chmod o=,ug=rwX -R /www
@ -26,6 +27,7 @@ COPY docker/cleanup.sh /cleanup.sh
RUN chmod o=,ug=rx /cleanup.sh
COPY docker/run.sh /run.sh
RUN chmod o=,ug=rx /run.sh
COPY docker/docker_config.php /docker_config.php
# install lighttpd
RUN apk add lighttpd php7-mcrypt && \

View File

@ -6,4 +6,4 @@ do
php /www/admin.php clean_async
# wait 24 hours
sleep 86400
done
done

39
docker/docker_config.php Normal file
View File

@ -0,0 +1,39 @@
<?php
/*
* Jirafeau, your web file repository
* Copyright (C) 2020 Jérôme Jutteau <jerome@jutteau.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
define('JIRAFEAU_ROOT', '/www/');
define('JIRAFEAU_CFG', JIRAFEAU_ROOT . 'lib/config.local.php');
require(JIRAFEAU_ROOT . 'lib/settings.php');
require(JIRAFEAU_ROOT . 'lib/functions.php');
require(JIRAFEAU_ROOT . 'lib/lang.php');
function env_2_cfg_string($cfg, $config_name, $env_name)
{
$r = getenv($env_name, true);
if ($r === false) {
return;
}
echo("setting up '" . $env_name . "' option\n");
$cfg[$config_name] = $r;
jirafeau_export_cfg($cfg);
}
// TODO: lots of other options to implement
env_2_cfg_string($cfg, 'file_hash', 'FILE_HASH');
echo("docker config done\n");

View File

@ -1,4 +1,5 @@
#!/bin/sh -e
/cleanup.sh &
php-fpm -D
php /docker_config.php
lighttpd -D -f /etc/lighttpd/lighttpd.conf