From 6cf9710ac1838e95a55dc0c9049ad8a339a3f310 Mon Sep 17 00:00:00 2001 From: Ruben Date: Wed, 14 Jan 2026 20:24:41 +0100 Subject: [PATCH] Add Docker configuration for PHP 8.4 Apache container Enable Apache rewrite module and custom configuration Configure logging to container output streams Update compose file to use build context instead of direct image Remove redundant volume mount for apache.conf Remove unnecessary command override --- Dockerfile | 12 ++++++++++++ compose.yaml | 7 +------ 2 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a7b99d3 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM php:8.4.14-apache + +# Enable Apache modules and custom config as root during build +RUN a2enmod rewrite + +COPY apache.conf /etc/apache2/conf-available/custom.conf +RUN a2enconf custom + +# Log to /proc/self/fd for container output +RUN sed -i 's|ErrorLog.*|ErrorLog /proc/self/fd/2|' /etc/apache2/sites-available/000-default.conf \ + && sed -i 's|CustomLog.*|CustomLog /proc/self/fd/1 combined|' /etc/apache2/sites-available/000-default.conf \ + && sed -i 's|ErrorLog.*|ErrorLog /proc/self/fd/2|' /etc/apache2/apache2.conf diff --git a/compose.yaml b/compose.yaml index 085bf66..2a31ee8 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,16 +1,11 @@ -version: '3.8' - services: custom: - # image: php:8.3.12-apache - image: php:8.4.14-apache + build: . container_name: stopplidelsen.no working_dir: /var/www/html/ volumes: - ./app:/var/www/app:z - ./content:/var/www/html:z - ./custom:/var/www/custom:z - - ./apache.conf:/etc/apache2/conf-available/custom.conf:z ports: - "4040:80" - command: bash -c "a2enconf custom && a2enmod rewrite && apache2-foreground"