From e31b7b3e6008ee380b672517d4d7c90f68286d07 Mon Sep 17 00:00:00 2001
From: Jonas Leder <jonas@jonasled.de>
Date: Mon, 16 Aug 2021 17:11:03 +0200
Subject: [PATCH] use alpine for webserver

---
 Dockerfile | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/Dockerfile b/Dockerfile
index 5ff8fb6..6020980 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -14,32 +14,29 @@ COPY --from=buildJS /build /build
 RUN cd /build/public/API && composer install
 
 # Prepare Webserver
-FROM php:8-apache-buster
+FROM httpd:alpine
 
 # |--------------------------------------------------------------------------
-# | install php extensions
+# | install dependencies
 # |--------------------------------------------------------------------------
-RUN docker-php-ext-install mysqli
-
-# |--------------------------------------------------------------------------
-# | enable production php ini
-# |--------------------------------------------------------------------------
-RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
+RUN apk update && \
+    apk upgrade && \
+    apk add php8-apache2 php8-mysqli curl
 
 # |--------------------------------------------------------------------------
 # | copy website from node build
 # |--------------------------------------------------------------------------
-COPY --from=composer /build/public /var/www/html
+COPY --from=composer /build/public /usr/local/apache2/htdocs/
 
 # |--------------------------------------------------------------------------
 # | enable apache modules
 # |--------------------------------------------------------------------------
-RUN a2enmod headers rewrite
+RUN sed -i '/LoadModule rewrite_module/s/^#//g' /usr/local/apache2/conf/httpd.conf && \
+    sed -i 's#AllowOverride [Nn]one#AllowOverride All#' /usr/local/apache2/conf/httpd.conf
 
 # |--------------------------------------------------------------------------
-# | enable metrics
+# | enable healthcheck
 # |--------------------------------------------------------------------------
-RUN apt update && apt install curl
 HEALTHCHECK CMD curl --fail http://localhost || exit 1  
 
 # |--------------------------------------------------------------------------
-- 
GitLab