Update Dockerfile

This commit is contained in:
Alexandre
2025-01-06 09:48:07 +01:00
committed by GitHub
parent 64c0e3c3f6
commit 5d2a344b99

View File

@@ -40,16 +40,14 @@ ENV APACHE_RUN_USER=www-data \
# Global variables # Global variables
ENV WEBTREES_HOME="/var2/www/webtrees" ENV WEBTREES_HOME="/var2/www/webtrees"
WORKDIR $WEBTREES_HOME WORKDIR $WEBTREES_HOME
# hadolint ignore=DL4006, SC2016 # hadolint ignore=DL4006
RUN \ RUN \
# Change data location # Change data location
grep -rl "/var/www/webtrees" /etc | xargs sed -i 's|/var/www/webtrees|/var2/www/webtrees|g' \ grep -rl "/var/www/webtrees" /etc | xargs sed -i 's|/var/www/webtrees|/var2/www/webtrees|g' \
&& sed -i 's|/var/www/webtrees|/var2/www/webtrees|g' /docker-entrypoint.py \ && sed -i 's|/var/www/webtrees|/var2/www/webtrees|g' /docker-entrypoint.py \
&& mkdir -p /var2 \ && mkdir -p /var2 \
&& cp -rf /var/* /var2/ \ && cp -rf /var/* /var2/ \
&& chown -R www-data:www-data /var2/www/webtrees \ && chown -R www-data:www-data /var2/www/webtrees
# Avoid log spam
&& [ -d /etc/apache2/sites-available ] && for file in /etc/apache2/sites-*/*.conf; do sed -i '/<VirtualHost/a \# Match requests with the custom User-Agent "HealthCheck"\\nSetEnvIf User-Agent "*HealthCheck*" dontlog\\n\# Exclude matching requests from access logs\\nCustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; done
################## ##################
# 3 Install apps # # 3 Install apps #
@@ -129,6 +127,7 @@ LABEL \
################# #################
# Avoid spamming logs with Apache # Avoid spamming logs with Apache
# hadolint ignore=SC2016
RUN if [ -d /etc/apache2/sites-available ]; then for file in /etc/apache2/sites-*/*.conf; do sed -i '/<VirtualHost/a # Match requests with the custom User-Agent "HealthCheck" \n SetEnvIf User-Agent "HealthCheck" dontlog \n # Exclude matching requests from access logs \n CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; done; fi RUN if [ -d /etc/apache2/sites-available ]; then for file in /etc/apache2/sites-*/*.conf; do sed -i '/<VirtualHost/a # Match requests with the custom User-Agent "HealthCheck" \n SetEnvIf User-Agent "HealthCheck" dontlog \n # Exclude matching requests from access logs \n CustomLog ${APACHE_LOG_DIR}/access.log combined env=!dontlog' "$file"; done; fi
ENV HEALTH_PORT="80" \ ENV HEALTH_PORT="80" \