Browse Source

feat: handle alpine configuration

Signed-off-by: rare-magma <[email protected]>
rare-magma 1 year ago
parent
commit
611c1a1743
1 changed files with 16 additions and 3 deletions
  1. 16 3
      docker/entrypoint.sh

+ 16 - 3
docker/entrypoint.sh

@@ -12,6 +12,11 @@ cp /speedtest/*.js /var/www/html/
 # Copy favicon
 cp /speedtest/favicon.ico /var/www/html/
 
+# Set custom webroot on alpine
+if [ -f /etc/alpine-release ]; then
+  sed -i "s#\"/var/www/localhost/htdocs\"#\"/var/www/html\"#g" /etc/apache2/httpd.conf
+fi
+
 # Set up backend side for standlone modes
 if [[ "$MODE" == "standalone" || "$MODE" == "dual" ]]; then
   cp -r /speedtest/backend/ /var/www/html/backend
@@ -81,11 +86,19 @@ chown -R www-data /var/www/html/*
 
 # Allow selection of Apache port for network_mode: host
 if [ "$WEBPORT" != "80" ]; then
-  sed -i "s/^Listen 80\$/Listen $WEBPORT/g" /etc/apache2/ports.conf
-  sed -i "s/*:80>/*:$WEBPORT>/g" /etc/apache2/sites-available/000-default.conf
+  if [ -f /etc/alpine-release ]; then
+    sed -i "s/^Listen 80\$/Listen $WEBPORT/g" /etc/apache2/httpd.conf
+  else
+    sed -i "s/^Listen 80\$/Listen $WEBPORT/g" /etc/apache2/ports.conf
+    sed -i "s/*:80>/*:$WEBPORT>/g" /etc/apache2/sites-available/000-default.conf
+  fi
 fi
 
 echo "Done, Starting APACHE"
 
 # This runs apache
-exec apache2-foreground
+if [ -f /etc/alpine-release ]; then
+  exec httpd -DFOREGROUND
+else
+  exec apache2-foreground
+fi