18 lines
712 B
Docker
18 lines
712 B
Docker
FROM php:8.3-apache
|
|
|
|
# Suppress ServerName warning
|
|
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
|
|
|
# Increase PHP limits for large code files
|
|
RUN echo "memory_limit=512M" > /usr/local/etc/php/conf.d/custom.ini \
|
|
&& echo "max_execution_time=300" >> /usr/local/etc/php/conf.d/custom.ini
|
|
|
|
COPY . /var/www/html/
|
|
RUN chown -R www-data:www-data /var/www/html
|
|
|
|
# Dynamically set the port to $PORT (defaulting to 80 if not set)
|
|
# We use the shell form of CMD to ensure variable expansion
|
|
CMD sed -i "s/Listen 80/Listen ${PORT:-80}/g" /etc/apache2/ports.conf && \
|
|
sed -i "s/<VirtualHost \*:80>/<VirtualHost *:${PORT:-80}>/g" /etc/apache2/sites-available/000-default.conf && \
|
|
apache2-foreground
|