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
This commit is contained in:
Ruben 2026-01-14 20:24:41 +01:00
parent 7d12fe5654
commit 6cf9710ac1
2 changed files with 13 additions and 6 deletions

12
Dockerfile Normal file
View file

@ -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

View file

@ -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"