From caf5fae8a849f740a603e0377be75df2043fae7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Gro=C3=9Fer?= Date: Mon, 21 Jun 2021 19:33:21 +0200 Subject: Added feature for subfolder hosting By setting the SUBFOLDER env var, you can host Homer in a subfolder behind a reverse proxy. --- entrypoint.sh | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'entrypoint.sh') diff --git a/entrypoint.sh b/entrypoint.sh index f1a8c22..9da2615 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -11,5 +11,11 @@ fi # Install default config if no one is available. yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null +# Create symbolic link for hosting in subfolder. +if [[ -n "${SUBFOLDER}" ]]; then + ln -s /www "/www/$SUBFOLDER" + chown -h $USER:$GROUP "/www/$SUBFOLDER" +fi + chown -R $UID:$GID /www/assets exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT" -- cgit v1.2.3 From b6b31e440c7915e82fe8b9a4b93083ec9fb2e9fd Mon Sep 17 00:00:00 2001 From: Kirmy Date: Thu, 9 Dec 2021 13:09:09 +0100 Subject: Replaced darkhttpd with lighttpd --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'entrypoint.sh') diff --git a/entrypoint.sh b/entrypoint.sh index 9da2615..e10e17e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -18,4 +18,6 @@ if [[ -n "${SUBFOLDER}" ]]; then fi chown -R $UID:$GID /www/assets -exec su-exec $UID:$GID darkhttpd /www/ --no-listing --port "$PORT" + +echo "Starting webserver" +lighttpd -D -f /lighttpd.conf -- cgit v1.2.3 From 049f85221e945b90bf87d21afe4d306839d65740 Mon Sep 17 00:00:00 2001 From: Bastien Wirtz Date: Sun, 10 Apr 2022 11:55:11 +0200 Subject: Simplify the container starting process to allow it to run with a unprivileged user --- entrypoint.sh | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'entrypoint.sh') diff --git a/entrypoint.sh b/entrypoint.sh index e10e17e..eba1cb2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,23 +1,18 @@ #!/bin/sh -# Ensure default assets are present. -while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null +PERMISSION_ERROR="Check assets directory permissions & docker user or skip default assets install by setting the INIT_ASSETS env var to 0" -# Ensure compatibility with previous version (config.yml was in the root directory) -if [ -f "/www/config.yml" ]; then - yes n | cp -i /www/config.yml /www/assets/ &> /dev/null -fi - -# Install default config if no one is available. -yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null +# Default assets & exemple configuration installation if possible. +if [[ "${INIT_ASSETS}" == "1" ]] && [[ ! -f "/www/config.yml" ]]; then + echo "No configuration found, installing default config & assets" + if [[ ! -w "/www/assets/" ]]; then echo "Assets directory not writable. $PERMISSION_ERROR" && exit 1; fi + + while true; do echo n; done | cp -Ri /www/default-assets/* /www/assets/ &> /dev/null + if [[ $? -ne 0 ]]; then echo "Fail to copy default assets. $PERMISSION_ERROR" && exit 1; fi -# Create symbolic link for hosting in subfolder. -if [[ -n "${SUBFOLDER}" ]]; then - ln -s /www "/www/$SUBFOLDER" - chown -h $USER:$GROUP "/www/$SUBFOLDER" + yes n | cp -i /www/default-assets/config.yml.dist /www/assets/config.yml &> /dev/null + if [[ $? -ne 0 ]]; then echo "Fail to copy default config file. $PERMISSION_ERROR" && exit 1; fi fi -chown -R $UID:$GID /www/assets - echo "Starting webserver" lighttpd -D -f /lighttpd.conf -- cgit v1.2.3