[Dockerfile] Add custom config location (#2098)

This commit is contained in:
Bockiii 2021-09-05 05:10:54 +02:00 committed by GitHub
parent bcc15228d8
commit 455b5e09a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View File

@ -34,4 +34,6 @@ RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini" \
&& sed -ri -e 's/(MinProtocol\s*=\s*)TLSv1\.2/\1None/' /etc/ssl/openssl.cnf \
&& sed -ri -e 's/(CipherString\s*=\s*DEFAULT)@SECLEVEL=2/\1/' /etc/ssl/openssl.cnf
COPY --chown=www-data:www-data ./ /app/
COPY --chown=www-data:www-data ./ /app/
CMD ["/app/docker-entrypoint.sh"]

29
docker-entrypoint.sh Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# - Find custom files (bridges, whitelist, config.ini) in the /config folder
# - Copy them to the respective folders in /app
# This will overwrite previous configs and bridges of same name
# If there are no matching files, rss-bridge works like default.
find /config/ -type f -name '*.*' -print0 |
while IFS= read -r -d '' file; do
file_name="$(basename "$file")" # Strip leading path
if [[ $file_name = *" "* ]]; then
printf 'Custom Bridge %s has a space in the name and will be skipped.\n' "$file_name"
continue
fi
case "$file_name" in
*Bridge.php) yes | cp "$file" /app/bridges/ ;
chown www-data:www-data "/app/bridges/$file_name";
printf "Custom Bridge %s added.\n" $file_name;;
config.ini.php) yes | cp "$file" /app/ ;
chown www-data:www-data "/app/$file_name";
printf "Custom config.ini.php added.\n";;
whitelist.txt) yes | cp "$file" /app/ ;
chown www-data:www-data "/app/$file_name";
printf "Custom whitelist.txt added.\n";;
esac
done
# Start apache
apache2-foreground